plucury / pythonfutures

Automatically exported from code.google.com/p/pythonfutures
Other
0 stars 0 forks source link

Eliminate Globals used for thread tracking #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This patch adds a tracker to the base Executor that is used to track all 
threads / processes created by the Executor and do proper cleanup of said 
threads on Executor Shutdown / Python Exit.

This also unifies the API between Process|ThreadPoolExecutor a little as 
well. Making max_workers optional on both, and defaulting to cpu_count. 
Adds a worker_count property to the base Executor, that returns the number 
of workers, which is used instead of len(self._processes|threads) since the 
threads and processes are now tracked in the trackers. Also since the 
shutdown method is unified between the two implementations now it moves it 
to the base Executor.

All Tests pass on win32 & Ubuntu, I dont have access to OSX to test there

Original issue reported on code.google.com by digitalx...@gmail.com on 21 May 2010 at 7:29

GoogleCodeExporter commented 9 years ago
New patch with 2 additional tests to ensure it does not break the exit handler 
and 
still allows threads / processes to complete before final interpreter exit. 

Original comment by digitalx...@gmail.com on 23 May 2010 at 10:01

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by brian.qu...@gmail.com on 14 Nov 2010 at 3:49