On 3/6/2009 7:23 AM, Greg Ewing wrote:

> You'd have to do quite a lot more than that. I don't
> remember all the details, 

There is also the simplified GIL API, which only requires two function 
calls. This is e.g. how ctypes makes sure the GIL is held in callbacks 
to Python.

A 'with gil' block could just expand to:

{
    PyGILState_STATE _gilstate = PyGILState_Ensure();

    /* now we have the GIL */

    PyGILState_Release(_gilstate);
}

Nothing else is required. The simplified GIL API makes sure the function 
does not deadlock if the caller already has the GIL. The only 
requirement is that a call to PyGILState_Ensure should always have a 
matching call to PyGILState_Release.



Sturla Molden



_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to