[pypy-issue] [issue1470] Implement python3 sys.setswitchinterval()

Amaury Forgeot d Arc tracker at bugs.pypy.org
Sun Apr 28 17:49:58 CEST 2013

New submission from Amaury Forgeot d Arc <amauryfa at gmail.com>:

CPython 3.2 deprecated sys.setcheckinterval() which counts bytecodes, and has now sys.setswitchinterval() 
which is a duration in seconds (stored as microseconds).

The implementation is in Python/ceval_gil.h: a waiting thread calls take_gil(), which calls 
pthread_cond_timedwait. If this times out, it requests the running thread to drop the GIL.
[likewise, an incoming signal asks the running thread to exit the eval loop at the first occasion]

This method is believed to be more fair towards other threads, with the current method the thread that 
releases the GIL is often the first one to acquire it again.

messages: 5649
nosy: amaury, pypy-issue
priority: feature
status: unread
title: Implement python3 sys.setswitchinterval()

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list