Skip to content

JoinGuard should not panic in its destructor when unwinding another panic. #23172

Description

@theemathas

Currently, when the destructor of a JoinGuard runs, it will panic if the associated thread is panicking. (This is not properly documented)

The problem is that when another panic is happening and the JoinGuard's thread is also panicking, the program double-panics and aborts.

At least, I would like the JoinGuard to avoid double-panics (possibly by calling thread::panicking() first, and not panicking if that returns true).

I am not sure whether the destructor should block if the child thread is still running but the parent thread panics, but that is another problem.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions