On Fri, Mar 20, 2020 at 11:27 AM Victor Stinner <vstin...@python.org> wrote:
> I would prefer to continue to experiment passing tstate explicitly in
> internal C APIs until most blocker issues will be fixed. Once early
> work on running two subinterpreters in parallel will start working
> (one "GIL" per interpreter), I will be more open to reconsider using a
> TLS variable.

The PEP for parallel subinterpreters hasn't been accepted yet either, right?

> "Inefficient signal handling in multithreaded applications"
> https://bugs.python.org/issue40010

CPython's current signal handling architecture basically assumes that
signals are always delivered to the main thread. (Fortunately, on real
systems, this is almost always true.) In particular, it assumes that
if a syscall arrives while the main thread is blocked in a
long-running syscall, then the syscall will be interrupted, which is
only true when the signal is delivered to the main thread. AFAICT if
we really care about off-main-thread signals, then the only way to
handle them properly is for the signal handler to detect when they
happen, and redeliver the signal to the main thread using
pthread_kill, and then let the main thread set its own eval_breaker
etc.

-n

-- 
Nathaniel J. Smith -- https://vorpus.org
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/FTVIAXHDHUNQWLBZQ4YIQXTFFDZ762GL/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to