embed threaded python code, thread won't start right the way

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Dec 20 00:30:34 EST 2007


En Wed, 19 Dec 2007 23:45:28 -0300, Yue Fei <yue_f at yahoo.com> escribió:

> I have a multi thread python code, threads can start immediately if I  
> run on command line, but I can get them started right the way if I call  
> the same code from C/C++.

Only one thread at a time can execute Python code due to the GIL; in your  
case, the main thread is preventing the others to continue execution.
Read this section in the API Reference  
<http://docs.python.org/api/threads.html> to see how to enable other  
threads to run while you are executing pure C code.

-- 
Gabriel Genellina




More information about the Python-list mailing list