Skip to content

Commit 047ee0a

Browse files
committed
epoll: when an event disappears entirely, remove it from the ready list
1 parent 69be846 commit 047ee0a

File tree

1 file changed

+4
-1
lines changed
  • src/tools/miri/src/shims/unix/linux_like

1 file changed

+4
-1
lines changed

src/tools/miri/src/shims/unix/linux_like/epoll.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,14 @@ fn send_ready_events_to_interests<'tcx, 'a>(
564564
) -> InterpResult<'tcx> {
565565
let mut wakeup = false;
566566
for (&event_key, interest) in interests {
567+
let mut ready_list = epoll.ready_list.borrow_mut();
567568
// This checks if any of the events specified in epoll_event_interest.events
568569
// match those in ready_events.
569570
let flags = interest.events & event_bitmask;
570571
if flags == 0 {
572+
// Make sure we *remove* any previous item from the ready list, since this
573+
// is not ready any more.
574+
ready_list.remove(&event_key);
571575
continue;
572576
}
573577
// Geenrate a new event instance, with the flags that this one is interested in.
@@ -577,7 +581,6 @@ fn send_ready_events_to_interests<'tcx, 'a>(
577581
})?;
578582
// Add event to ready list for this epoll instance.
579583
// Tests confirm that we have to *overwrite* the old instance for the same key.
580-
let mut ready_list = epoll.ready_list.borrow_mut();
581584
ready_list.insert(event_key, new_instance);
582585
wakeup = true;
583586
}

0 commit comments

Comments
 (0)