Skip to content

Commit f94eb1b

Browse files
committed
log when we change the active thread
1 parent 34c16e7 commit f94eb1b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/concurrency/thread.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,13 @@ impl<'mir, 'tcx: 'mir> ThreadManager<'mir, 'tcx> {
445445

446446
/// Set an active thread and return the id of the thread that was active before.
447447
fn set_active_thread_id(&mut self, id: ThreadId) -> ThreadId {
448-
let active_thread_id = self.active_thread;
449-
self.active_thread = id;
450-
assert!(self.active_thread.index() < self.threads.len());
451-
active_thread_id
448+
assert!(id.index() < self.threads.len());
449+
info!(
450+
"---------- Now executing on thread `{}` (previous: `{}`) ----------------------------------------",
451+
self.get_thread_display_name(id),
452+
self.get_thread_display_name(self.active_thread)
453+
);
454+
std::mem::replace(&mut self.active_thread, id)
452455
}
453456

454457
/// Get the id of the currently active thread.
@@ -735,6 +738,11 @@ impl<'mir, 'tcx: 'mir> ThreadManager<'mir, 'tcx> {
735738
for (id, thread) in threads {
736739
debug_assert_ne!(self.active_thread, id);
737740
if thread.state == ThreadState::Enabled {
741+
info!(
742+
"---------- Now executing on thread `{}` (previous: `{}`) ----------------------------------------",
743+
self.get_thread_display_name(id),
744+
self.get_thread_display_name(self.active_thread)
745+
);
738746
self.active_thread = id;
739747
break;
740748
}

0 commit comments

Comments
 (0)