mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	bpo-36356: Destroy the GIL at exit (GH-12453)
* Add _PyEval_FiniThreads2(). _PyEval_FiniThreads() now only clears the pending lock, whereas _PyEval_FiniThreads2() destroys the GIL. * pymain_free() now calls _PyEval_FiniThreads2(). * Py_FinalizeEx() now calls _PyEval_FiniThreads().
This commit is contained in:
		
							parent
							
								
									7a5a1cfe04
								
							
						
					
					
						commit
						b36e5d627d
					
				
					 5 changed files with 26 additions and 18 deletions
				
			
		|  | @ -188,8 +188,19 @@ PyEval_InitThreads(void) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void | ||||
| _PyEval_FiniThreads(void) | ||||
| { | ||||
|     if (_PyRuntime.ceval.pending.lock != NULL) { | ||||
|         PyThread_free_lock(_PyRuntime.ceval.pending.lock); | ||||
|         _PyRuntime.ceval.pending.lock = NULL; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void | ||||
| _PyEval_FiniThreads2(void) | ||||
| { | ||||
|     if (!gil_created()) { | ||||
|         return; | ||||
|  | @ -197,11 +208,6 @@ _PyEval_FiniThreads(void) | |||
| 
 | ||||
|     destroy_gil(); | ||||
|     assert(!gil_created()); | ||||
| 
 | ||||
|     if (_PyRuntime.ceval.pending.lock != NULL) { | ||||
|         PyThread_free_lock(_PyRuntime.ceval.pending.lock); | ||||
|         _PyRuntime.ceval.pending.lock = NULL; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| static inline void | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner