<!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.&nbsp;
i've stripped down this code sample to hopefully just the part that
matters for demonstration purposes.&nbsp; if it's not enough, i'll be glad
to post more.&nbsp; the problem is that the cfunc_do_work() function calls
the _callback_wrapper function 36 times per second.&nbsp; the
_callback_wrapper then calls back into the python code that was passed
as the callback parameter of Play.play().&nbsp; a user of this library in
using it in a wxPython gui application.&nbsp; when Play.play() is called,
wxPython is not very responsive even when explicitly calling wxYield to
refresh the interface in the python callback function.&nbsp; 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.&nbsp; 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:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; def play(self, callback=None):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cfunc_set_callback(_callback_wrapper, &lt;void*&gt;callback)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while(cfunc_do_work()): pass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
cdef int _callback_wrapper(void *callback) except *:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; return (&lt;object&gt;callback)()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
<br>
<br>
<br>
thanks,<br>
<br>
<br>
bryan
</body>
</html>