mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	bpo-40221: Update multiprocessing to use _at_fork_reinit (GH-19511)
This commit is contained in:
		
							parent
							
								
									e560f90602
								
							
						
					
					
						commit
						a5900ecf9f
					
				
					 2 changed files with 10 additions and 9 deletions
				
			
		|  | @ -49,8 +49,7 @@ def __init__(self, maxsize=0, *, ctx): | |||
|         self._sem = ctx.BoundedSemaphore(maxsize) | ||||
|         # For use by concurrent.futures | ||||
|         self._ignore_epipe = False | ||||
| 
 | ||||
|         self._after_fork() | ||||
|         self._reset() | ||||
| 
 | ||||
|         if sys.platform != 'win32': | ||||
|             register_after_fork(self, Queue._after_fork) | ||||
|  | @ -63,11 +62,17 @@ def __getstate__(self): | |||
|     def __setstate__(self, state): | ||||
|         (self._ignore_epipe, self._maxsize, self._reader, self._writer, | ||||
|          self._rlock, self._wlock, self._sem, self._opid) = state | ||||
|         self._after_fork() | ||||
|         self._reset() | ||||
| 
 | ||||
|     def _after_fork(self): | ||||
|         debug('Queue._after_fork()') | ||||
|         self._notempty = threading.Condition(threading.Lock()) | ||||
|         self._reset(after_fork=True) | ||||
| 
 | ||||
|     def _reset(self, after_fork=False): | ||||
|         if after_fork: | ||||
|             self._notempty._at_fork_reinit() | ||||
|         else: | ||||
|             self._notempty = threading.Condition(threading.Lock()) | ||||
|         self._buffer = collections.deque() | ||||
|         self._thread = None | ||||
|         self._jointhread = None | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dong-hee Na
						Dong-hee Na