[Pyrex] GIL question

Bob Ippolito bob at redivi.com
Wed Oct 6 20:56:32 CEST 2004


On Oct 6, 2004, at 2:36 PM, Cory Dodt wrote:

> Does Pyrex provide any way to release the GIL?  We are encountering an 
> issue
> where a Twisted reactor for ObjC--known as cfreactor--is implemented 
> in Pyrex.
> ~ Recent changes in PyObjC require that the GIL be released and 
> acquired for
> things to work.
>
> The only way to fix this issue is to patch the generated C, so I'll 
> let that
> do the speaking for me:
>
> http://www.twistedmatrix.com/users/roundup.twistd/twisted/issue648
>
> Is there any way to do this in Pyrex?  Patching generated files is not 
> our
> idea of fun.  Thanks :-)

To clarify, the issue is this:

cfreactor has several callback functions that are called WITHOUT the 
GIL.  These callbacks need to safely acquire the GIL, run some Python 
code, and release the GIL when the callback completes.

Currently nobody is sure how to safely do PyGILState_Ensure and 
PyGILState_Release from Pyrex code.

-bob




More information about the Pyrex mailing list