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.
Currently, when the destructor of a
JoinGuardruns, 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
JoinGuardto avoid double-panics (possibly by callingthread::panicking()first, and not panicking if that returnstrue).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.