On Sun, Aug 14, 2011 at 9:26 AM, Guido van Rossum <gu...@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 | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com