threads

Aahz Maruch aahz at panix.com
Wed Aug 29 19:47:45 EDT 2001


In article <mailman.999103664.9602.python-list at python.org>,
Ayelet Snir <ayelet at kagoor.com> wrote:
>
>We have a project, written in Python and also C. Notice that we call to the
>C part from Python, using SWIG.
>In this project, we created 2 threads in the Python part:
>While moving from C to Python, we use: PyEval_AcquireLock, and swap the
>thread state. (On the other direction, we use: PyEval_ReleaseLock and swap
>the state back.)
>Till here, everything worked great.
>We tried to start another new thread, using the method start_new. We got the
>next message:
>Fatal Python error: PyEval_AcquireThread : non-NULL old thread state

You're better off using the macros Py_BEGIN_ALLOW_THREADS and
Py_END_ALLOW_THREADS.  I also recommend using the threading module
instead of the thread module.  See http://starship.python.net/crew/aahz/
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

"Plus ca change, plus c'est la meme chose."



More information about the Python-list mailing list