Threading - Why Not Lock Objects Rather than lock the interpreter

Daniel Dittmar daniel.dittmar at
Fri Dec 5 18:26:06 CET 2003

Fuzzyman wrote:
> 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.....

Because the reference counter of objects has to be synchronized.


More information about the Python-list mailing list