Python Embedding Thread

Jaimy Azle jazle at nospam.log.web.id
Tue Jul 22 06:23:48 CEST 2008


"Benjamin" <musiccomposition at gmail.com> wrote:

> Two threads should not be running through the Python VM concurrently
> in the same process. The GIL has to be held *any* time you use the
> Python API. When you want to release the GIL (to process something in
> C), use PY_BEGIN_ALLOW_THREADS and
> PY_END_ALLOW_THREADS around the
> places where threads can run.

I think he is trying to call python from thread, according to the 
documentation:

"Beginning with version 2.3, threads can now take advantage of the 
PyGILState_*() functions to do all of the above automatically."
 - http://docs.python.org/api/threads.html

I use it everywhere on my multithreaded server without problem.

Salam,

-Jaimy








More information about the Python-list mailing list