[Python-Dev] GIL removal question
Nick Coghlan
ncoghlan at gmail.com
Sun Aug 14 03:37:18 CEST 2011
On Sun, Aug 14, 2011 at 9:26 AM, Guido van Rossum <guido at python.org> wrote:
>> These days we have PyGILState_Ensure():
>> http://docs.python.org/dev/c-api/init.html#PyGILState_Ensure
>>
>> and even dedicated documentation:
>> http://docs.python.org/dev/c-api/init.html#non-python-created-threads
>>
>> ;)
>
> That is awesome!
Although, if it's possible to arrange it, it's still better to do that
once and then use BEGIN/END_ALLOW_THREADS to avoid the overhead of
creating and destroying the temporary thread states:
http://blog.ccpgames.com/kristjan/2011/06/23/temporary-thread-state-overhead/
Still, it's far, far easier than it used to be to handle the GIL
correctly from non-Python created threads.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-Dev
mailing list