
On Fri, Mar 20, 2020 at 11:27 AM Victor Stinner <vstinner@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