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

std: fix stdout-before-main #131233

Merged
merged 1 commit into from
Oct 12, 2024
Merged

std: fix stdout-before-main #131233

merged 1 commit into from
Oct 12, 2024

Commits on Oct 12, 2024

  1. std: fix stdout-before-main

    Fixes rust-lang#130210.
    
    Since rust-lang#124881, `ReentrantLock` uses `ThreadId` to identify threads. This has the unfortunate consequence of breaking uses of `Stdout` before main: Locking the `ReentrantLock` that synchronizes the output will initialize the thread ID before the handle for the main thread is set in `rt::init`. But since that would overwrite the current thread ID, `thread::set_current` triggers an abort.
    
    This PR fixes the problem by using the already initialized thread ID for constructing the main thread handle and allowing `set_current` calls that do not change the thread's ID.
    joboet committed Oct 12, 2024
    Configuration menu
    Copy the full SHA
    9f91c50 View commit details
    Browse the repository at this point in the history