Skip to content

Resolve at_exit strategy after std::thread lands #20012

@aturon

Description

@aturon
Member

The final step of runtime removal changes the threading/process model so that the process shuts down when the main thread exits. But several shared resources, like the helper thread for timeouts, are shut down when the main thread exits (but before the process ends), and they are not prepared to be used after shut down, but other threads may try to access them during the shutdown sequence of the main thread.

As an interim solution, the at_exit cleanup routine is simply skipped.

Ultimately, these resources should be made to safely handle asynchronous shutdown, usually by panicking if called from a detached thread when the main thread is ending.

Activity

added
A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
on Dec 19, 2014
aturon

aturon commented on Dec 19, 2014

@aturon
MemberAuthor

cc @alexcrichton

Nominating for P-High.

added a commit that references this issue on Dec 19, 2014

29 remaining items

added 2 commits that reference this issue on Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsP-mediumMedium priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @alexcrichton@brson@aturon

      Issue actions

        Resolve at_exit strategy after std::thread lands · Issue #20012 · rust-lang/rust