On 3/14/06, Raymond Hettinger <raymond.hettinger@verizon.net> wrote:
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.

Don't forget that sys.setcheckinterval() is more of a hint than a requirement. It's easy to wrap sys.setcheckinterval () in a try/except or an if-hasattr, and just ignore the case where it doesn't exist ('it won't be necessary'). Doing the same thing with a 'critical section' would be a lot harder. I would also assume a 'critical section' should not allow threads in extension modules, even if they explicitly allow threads. That's quite a bit different from making the check-interval infinitely high for the duration of the block.

--
Thomas Wouters <thomas@python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!