[Python-Dev] Threading idea -- exposing a global thread lock

Thomas Wouters thomas at python.org
Tue Mar 14 19:45:11 CET 2006

On 3/14/06, Raymond Hettinger <raymond.hettinger at 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 at python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060314/9e73c71c/attachment.htm 

More information about the Python-Dev mailing list