Use of Py_BEGIN_ALLOW_THREADS?

Bill Eldridge bill at rfa.org
Wed Apr 11 05:56:47 EDT 2001


I'm calling a C function from Python,
and that C function in turn calls
another C function #2 with a C callback
function.

Somewhere it seems like with threads
it disappears - all of the debug
messages in function #2 come out,
but the C callback never gets called.

I try to surround the original call of function
#2 with:

Py_BEGIN_ALLOW_THREADS
c_function_2()
Py_END_ALLOW_THREADS

which compiles and runs, but still doesn't work.

Do I need to surround the actual call of the
callback routine?  And if that callback calls
another callback?

Py_BEGIN_ALLOW_THREADS
call_callback(item1,item2,&c_callback)
Py_END_ALLOW_THREADS

c_callback(...) {
  call_callback2(item3, item4, &c_callback2)
}

and so on?  Basically it's hard to get diagnostics
on where/why it disappears.  Any thoughts?

Thanks,
Bill

--
Bill Eldridge
Radio Free Asia
bill at rfa.org



More information about the Python-list mailing list