asynchronous callback

Silvio Arcangeli sarcangeli at montrouge.sema.slb.com
Tue Aug 21 13:26:53 EDT 2001


Hello everybody,
I'm new to this list. My name is Silvio, and I discovered Python just a 
month ago.
I'm currently using it to test the API of a CORBA platform (I use Python to 
test the C API and Jython to test the Java API), it works great.
I have a problem with some operations that are run in background and return 
their result passing a report to a callback function.
In my case the callback function should actually be a Python method.
So I added a C callback function to my extension module: it just converts 
the parameters, and then calls the Python method.
I saw an example implementation of such a technique in the Python cookbook: 
in that case the author stored the Python callback method in a C static 
global variable, but I'm actually using a Python dictionary, cause I can 
have several callback functions and I find this solution more flexible.
Anyway, the C function correctly retrieves the Python method from the 
dictionary, but then when it calls it it gets blocked.
I think that this is probably due to the fact that the C callback function 
is called asynchronously (that means it runs in a different thread from the 
interpreter's one).
How can I make it work?

bye,
Silvio.





More information about the Python-list mailing list