[Pyrex] pyrex and GIL

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Feb 18 05:39:32 CET 2004


Bob Ippolito <bob at redivi.com>:

> Have you tried using a callback function that looks like:
> 
> cdef callback:
> 	acquire GIL
> 	call the 'actual' function (maybe not even a cdef) that might throw an 
> exception
> 	release GIL

If the GIL is not held when the callback is called, there
will certainly be problems, whether threads are involved
or not. The above will need to be done in that case.

I don't know enough about threads to say whether they
introduce any added complications, though.

By the way, I have a feature in mind for some future
version that may help with GIL issues. In the meantime
you'll have to make the necessary calls yourself.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list