avoid reentrant lock acquire when ThreadIds run out
This commit is contained in:
parent
619c27a539
commit
2750d3ac6a
1 changed files with 1 additions and 0 deletions
|
@ -1004,6 +1004,7 @@ impl ThreadId {
|
|||
// If we somehow use up all our bits, panic so that we're not
|
||||
// covering up subtle bugs of IDs being reused.
|
||||
if COUNTER == u64::MAX {
|
||||
drop(_guard); // in case the panic handler ends up calling `ThreadId::new()`, avoid reentrant lock acquire.
|
||||
panic!("failed to generate unique thread ID: bitspace exhausted");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue