<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body>
hi all,<br>
<br>
i have a problem that someone on this list might be able to help with.
i've stripped down this code sample to hopefully just the part that
matters for demonstration purposes. if it's not enough, i'll be glad
to post more. the problem is that the cfunc_do_work() function calls
the _callback_wrapper function 36 times per second. the
_callback_wrapper then calls back into the python code that was passed
as the callback parameter of Play.play(). a user of this library in
using it in a wxPython gui application. when Play.play() is called,
wxPython is not very responsive even when explicitly calling wxYield to
refresh the interface in the python callback function. my first
instinct was that this might be a GIL problem and somehow i must make
sure that pyrex doesn't own the GIL while cfunc_do_work() is called. i
looked at the pyrex generated c code and i don't see any GIL functions
being called, so i'm not sure if i implicitly have it or not, where and
how i'm supposed to release it, or if this is even the real problem.<br>
<br>
<br>
cdef class Play: <br>
def play(self, callback=None):<br>
cfunc_set_callback(_callback_wrapper, <void*>callback)<br>
while(cfunc_do_work()): pass <br>
<br>
<br>
cdef int _callback_wrapper(void *callback) except *: <br>
return (<object>callback)() <br>
<br>
<br>
<br>
thanks,<br>
<br>
<br>
bryan
</body>
</html>