[Python-Dev] GIL removal question (original) (raw)
Nick Coghlan ncoghlan at gmail.com
Sun Aug 14 03:37:18 CEST 2011
- Previous message: [Python-Dev] GIL removal question
- Next message: [Python-Dev] GIL removal question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, Aug 14, 2011 at 9:26 AM, Guido van Rossum <guido at python.org> wrote:
These days we have PyGILStateEnsure(): http://docs.python.org/dev/c-api/init.html#PyGILStateEnsure
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
- Previous message: [Python-Dev] GIL removal question
- Next message: [Python-Dev] GIL removal question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]