logo       

Re: too much work in c function: msg#00054

python.pyrex

Subject: Re: too much work in c function

On Wed, 28 Apr 2004 21:44:16 -0700
Bryan Weingarten <bryan.weingarten@xxxxxxxxx> wrote:

> hi all,
>
> 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 be
ing 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.
>

Usually GIL problems result in a lockup or a crash.
Have you looked at
http://sourceforge.net/projects/dsptools/ ?
The portaudio module uses the GIL to call back into python from a thread
created by c-code.
I'm not sure if this is your situation.

cheers,
Simon.

--
Simon Burton, B.Sc.
Licensed PO Box 8066
ANU Canberra 2601
Australia
Ph. 61 02 6249 6940
http://arrowtheory.com


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise