
Actually, I think all that's needed is another global like the interpreter_lock in ceval.c. Since this lock is only accessed via abstract functions, I presume the unlock flag could easily be added.
Well, my personal opinion is that this is really quite wrong. The most obvious thing to me is that we are exposing an implementation detail we all would dearly like to see removed one day - the global interpreter lock. But even if we ignore that, it seems to me that you are describing an application abstraction, not a language abstraction. This thread started with Jim wanting a thread-safe, atomic list operation. This is not an unusual requirement (ie, a thread-safe, atomic operation), so languages give you access to primitives that let you build this. To my mind, you are asking for the equivilent of a C function that says "suspend all threads except me, cos Im doing something _really_ important". C does not provide that, and I have never thought it should. As Gordon said, Win32 has critical sections, but these are really just lightweight locks. I really dont see how Python is different - it gives you all the tools you need to build these abstractions. I really dont see what you are after that can not be done with a lock. If the performance is a problem, then to paraphrase the Timbot, it may be questionable if you are using Python appropriately in this case. Mark.