Skip to content

Commit

Permalink
Fix hanging on SIGINT
Browse files Browse the repository at this point in the history
Ask other worker threads to yield the device lock when using
try_writeable. Otherwise it will hang indefinitely since other threads
constantly keep the read lock
  • Loading branch information
jjanowsk committed Dec 19, 2024
1 parent b3b6679 commit 6927651
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion neptun/src/device/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,10 @@ impl DeviceHandle {
Action::Continue => {}
Action::Yield => break,
Action::Exit => {
device_lock.try_writeable(|_| {}, |dev| dev.closed = true);
device_lock.try_writeable(
|dev| dev.trigger_yield(),
|dev| dev.closed = true,
);
device_lock.trigger_exit();
return;
}
Expand Down

0 comments on commit 6927651

Please sign in to comment.