New submission from Amaury Forgeot d Arc <[email protected]>:

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 <[email protected]>
<https://bugs.pypy.org/issue1470>
________________________________________
_______________________________________________
pypy-issue mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to