What is situation with threads in Python

Jp Calderone exarkun at divmod.com
Mon Apr 25 14:16:00 EDT 2005


On Mon, 25 Apr 2005 14:10:28 -0400, Bill Mill <bill.mill at gmail.com> wrote:
>On 4/25/05, Leonard J. Reder <reder at jpl.nasa.gov> wrote:
>> Hello Mark,
>>
>> I took your three day course here at JPL and recall that you said
>> something was wrong with the implementation of threads within Python
>> but I cannot recall what.  So what is wrong with threads in Python?
>
>I'm going to guess that he meant the Global Interpreter Lock is what's
>wrong with Python threads. You can read about it in the docs at
>http://docs.python.org/api/threads.html and get some good analysis
>from Ian Bicking (with some excellent, and some not so excellent,
>comments): http://blog.ianbicking.org/gil-of-doom.html .
>
>>
>> The other part of this question is, if there is something wrong with
>> the threads in Python has anyone wrapped the Posix threads C api using
>> swig to fix this problem?  I work on Solaris/Linux systems and this
>> seems like a quick fix - maybe.
>>
>
>Nope, since the interpreter is not entirely thread-safe, I don't
>believe you can wrap pthreads.

  Python _does_ wrap pthreads, where it is appropriate to do so.  Whether another threading library is present, it wraps that instead.  Whatever happens, it presents the result in the form of the thread module.

  Jp



More information about the Python-list mailing list