Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.12] gh-102512: Turn _DummyThread into _MainThread after os.fork() called from a foreign thread (GH-113261) #114430

Merged
merged 1 commit into from
Jan 22, 2024

Commits on Jan 22, 2024

  1. pythongh-102512: Turn _DummyThread into _MainThread after os.fork() c…

    …alled from a foreign thread (pythonGH-113261)
    
    Always set a _MainThread as a main thread after os.fork() is called from
    a thread started not by the threading module.
    
    A new _MainThread was already set as a new main thread after fork if
    threading.current_thread() was not called for a foreign thread before fork.
    Now, if it was called before fork, the implicitly created _DummyThread will
    be turned into _MainThread after fork.
    
    It fixes, in particularly, an incompatibility of _DummyThread with
    the threading shutdown logic which relies on the main thread
    having tstate_lock.
    
    (cherry picked from commit 49785b0)
    
    Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
    Co-authored-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    serhiy-storchaka and marmarek committed Jan 22, 2024
    Configuration menu
    Copy the full SHA
    3ad1a1c View commit details
    Browse the repository at this point in the history