Embed python in multi-thread environment

Arlo arlo.maillist at ozmaker.com
Sun Jun 9 11:28:02 EDT 2002


hi, all

i've tried to embed python in multi-thread application( written in c++)
the flow is:

1.create socket,listen,accept.
2. create thread to handle different clients.
3. in thread func, use Python C API to import my python script, and use 
PyObject_CallObject(func,args);
    to call python function ( just passing socket descriptor which got 
from accept() to this function)

but when it just one client, it works perfect, but when more than one 
client, it core dumped.
it seems i can't call PyObject_CallObject twice at the same process?








More information about the Python-list mailing list