[Python-Dev] I'd like list.pop to accept an optional second
Gordon McMillan
gmcm@hypernet.com
Sat, 24 Jul 1999 07:41:39 -0500
M.-A. Lemburg writes:
> True, sys.lock.acquire() would have to set a flag *not* to release
> the lock until the next call to sys.lock.release(), which then
> clears this flag again. Sort of a lock for the unlocking the lock
> ;-)
>
> Could this work, or am I having a mind twister somewhere in
> there again ?
Sounds like a critical section to me. On Windows, those are
lightweight and very handy. You can build one with Python thread
primitives, but unfortunately, they come out on the heavy side.
Locks come in 4 types, categorized by whether they can be released
only by the owning thread, and whether they can be acquired
recursively. The interpreter lock is in the opposite quadrant from a
critical section, so "sys.lock.freeze()" and "sys.lock.thaw()" have
little chance of having an efficient implementation on any platform.
A shame. That would be pretty cool.
- Gordon