diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index c8b6046bb8d6..98feea96f8c4 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -550,6 +550,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 { + GUARD.unlock(); panic!("failed to generate unique thread ID: bitspace exhausted"); }