On Jan 23, 5:46 pm, Tim Spens <[EMAIL PROTECTED]> wrote:
> I have a c++ program running that has boost python hooks for the c++ api.
> I'm running a python client that makes calls into the c++ api. The problem
> is there are c++
> asynchronous callbacks that need to pass information to the python client.
> What I was hoping to
> do is call a python function from c++ that resides in the running "main()"
> python client
> while in the c++ callback handlers.
> Is this possible and if you can point me to an example or documentation on
> how to do this it would be much appreciated?
>
> NOTE: I've been asking on the c++-sig mailing list about this and David
> Abrahams (very well versed in boost python) said:
> "I'm not an expert on asynchronous python and this is really not a
> Boost.Python question. I suggest you ask on the regular Python mailing list.
> Sorry."
PyObject_CallFunction.
You might need to pass -out- a Thread instance, initialized with your
callback, then just call start, or just the pointer to start.
import threading
import time
def f( func )
func()
def g( caption ):
for _ in range( 1000 ):
print '%s\n'% caption,
time.sleep( .01 )
th= threading.Thread( target= g, args= ( 'what' ) )
f( th.start )
time.sleep( 10 )
--
http://mail.python.org/mailman/listinfo/python-list