Skip to content

Commit baadb63

Browse files
committed
Only set new thread once an unblocked thread is found.
1 parent b38d2cd commit baadb63

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/concurrency/thread.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -724,12 +724,12 @@ trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> {
724724
);
725725
this.unblock_thread(next_thread_id, BlockReason::Genmc)?;
726726
}
727-
// Set the new active thread.
728-
let thread_manager = &mut this.machine.threads;
729-
thread_manager.active_thread = next_thread_id;
730-
// A thread blocked by GenMC may get blocked again during the unblocking callback.
727+
// The thread we just unblocked may have been blocked again during the unblocking callback.
731728
// In that case, we need to ask for a different thread to run next.
732-
if thread_manager.threads[thread_manager.active_thread].state.is_enabled() {
729+
let thread_manager = &mut this.machine.threads;
730+
if thread_manager.threads[next_thread_id].state.is_enabled() {
731+
// Set the new active thread.
732+
thread_manager.active_thread = next_thread_id;
733733
return interp_ok(SchedulingAction::ExecuteStep);
734734
}
735735
}

0 commit comments

Comments
 (0)