Martin Gysel wrote:
> Stefan Behnel wrote:
>> do you just register your callback and it gets called at some later
>> point?
>
> I register it and it gets called at some time. As
> already said, the library starts a new thread... at the time the
> callback gets called no cython code is supposed to run except the
> callback itself of course.
>
> 1. register callback
> 2. start library thread
> 3. ... (at the moment I just do nothing apart of waiting)

How do you wait? using time.wait()?


> 4. callback gets called (here I want to deal with either the library or
> my cython object)
> 5. segfault :-(
>
> really strange for me is it segfaults immediately if I use with gil. is
> it possible the gil is held by another function?

No. The GIL is an exclusive lock. When you get hold of it, you are the
only one who has it. Declaring your callback function "with gil" is
exactly the right thing to do here.

BTW, are you sure that threading support has been initialised in your
program? Just a wild guess, but maybe "import threading" at module level
helps? If so, we may be able to fix that.

It would be good if you could come up with a small test program that shows
exactly the code you use. Also, so far, we do not know which library you
are interfacing with. Is the library thread based on pthreads (which
Python uses)?

Stefan

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

Reply via email to