[Python-Dev] Threading idea -- exposing a global thread lock
raymond.hettinger at verizon.net
Tue Mar 14 19:30:54 CET 2006
[Nice analysis from Michael Chermside]
> The concept of a "critical section" makes great sense when there is
> effectively only one CPU: just stop switching threads. But if code
> is using multiple CPUs, what does it mean? Shut down the other CPUs?
. . .
> I think it is unwise to build such a
> feature into the Python language. Supporting it in CPython only
> requires (I think) no more than a very simple C extension. I think
> it should stay as an extension and not become part of the language.
That makes sense.
Once place where we already have CPython specific support is in
sys.setcheckinterval(). That suggests adapting that function or adding a new
one to temporarily stop switching, almost the same as
sys.setcheckinterval(sys.maxint) but continuing to perform other periodic checks
for control-break and such.
More information about the Python-Dev