Threading - Why Not Lock Objects Rather than lock the interpreter

Fuzzyman michael at
Fri Dec 5 15:32:31 CET 2003

Looking at threading code it seems that the Global Interpreter Lock is
a bit of a 'brute force' way of preventing two threads attempting to
access sensitive objects simultaneously....

Why not have a new type of object with a 'lock' facility... if an
object is locked then any thread trying to access the object other
than the one obtaining the lock is blocked until the lock is
released..... rather than blocking *all* threads until one thread has
finished with the object.....

It could be implemented as a new attribute of existing objects... or
new types of objects.....


More information about the Python-list mailing list