[Python-Dev] Threading idea -- exposing a global thread lock (original) (raw)

Phillip J. Eby pje at telecommunity.com
Tue Mar 14 20:30:57 CET 2006


At 02:21 PM 3/14/2006 -0500, Tim Peters wrote:

There is some variation in what "critical section" means, exactly, to different thread programming cultures, but in none does it mean:

a section of code such that, once a thread enters it, all other threads are blocked from doing anything for the duration

Well, I'm showing my age here, but in the good ol' days of the 8086 processor, I recall it frequently being used to describe a block of assembly code which ran with interrupts disabled - ensuring that no task switching would occur.

Obviously I haven't been doing a lot of threaded programming since those days, except in Python. :)

The common meaning is:

a section of code such that, once a thread enters it, all other threads are blocked from entering the section for the duration

That doesn't seem like a very useful definition, since it describes any piece of code that's protected by a statically-determined mutex. But you clearly have more experience in this than I.



More information about the Python-Dev mailing list