Skip to content

Commit b1174a4

Browse files
Zoxccuviper
authored andcommitted
Fix a race with deadlock detection
1 parent 5bdcebb commit b1174a4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

rayon-core/src/sleep/mod.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,10 @@ impl Sleep {
423423
let mut is_blocked = sleep_state.is_blocked.lock().unwrap();
424424
if *is_blocked {
425425
*is_blocked = false;
426+
427+
// Increment the number of active threads
428+
self.data.lock().unwrap().active_threads += 1;
429+
426430
sleep_state.condvar.notify_one();
427431

428432
// When the thread went to sleep, it will have incremented
@@ -436,9 +440,6 @@ impl Sleep {
436440
// do.
437441
self.counters.sub_sleeping_thread();
438442

439-
// Increment the number of active threads
440-
self.data.lock().unwrap().active_threads += 1;
441-
442443
self.logger.log(|| ThreadNotify { worker: index });
443444

444445
true

0 commit comments

Comments
 (0)