Python threading (was: Re: global interpreter lock not working as it should)

Jonathan Hogg jonathan at
Mon Aug 5 19:43:24 CEST 2002

On 5/8/2002 17:33, in article
mailman.1028565444.27880.python-list at, "Tim Peters"
< at> wrote:

> There's also an historic reason for the way the pthreads lock works:  at the
> time I wrote that, the pthread spec was very young and undergoing rapid
> change.  At the time, a pthread mutex was never intended to be held for an
> appreciable time -- it was widely believed that a busy loop was an
> appropriate implementation.  For that reason, the Python code is careful
> never to hold the mutex across more than just a few very small C statements.
> Mutexes got fancier over the years, but that design still seems a good one.

Aha, now that's interesting. So do you think it would be safe to use a
regular mutex now?

I was considering trying it, but I wasn't sure if there was a Very Good
Reason not to.


More information about the Python-list mailing list