We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c5cb2de commit 2c8cc70Copy full SHA for 2c8cc70
library/std/src/thread/scoped.rs
@@ -29,7 +29,7 @@ impl ScopeData {
29
pub(super) fn increment_n_running_threads(&self) {
30
// We check for 'overflow' with usize::MAX / 2, to make sure there's no
31
// chance it overflows to 0, which would result in unsoundness.
32
- if self.n_running_threads.fetch_add(1, Ordering::Relaxed) == usize::MAX / 2 {
+ if self.n_running_threads.fetch_add(1, Ordering::Relaxed) > usize::MAX / 2 {
33
// This can only reasonably happen by mem::forget()'ing many many ScopedJoinHandles.
34
self.decrement_n_running_threads(false);
35
panic!("too many running threads in thread scope");
0 commit comments