Skip to content

Commit

Permalink
test: fix edge-oneshot trigger on other platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
Berrysoft committed Jun 11, 2024
1 parent 34f7cac commit 16b6fa6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/other_modes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,6 @@ fn edge_oneshot_triggered() {
.unwrap();
assert!(events.is_empty());

// On Windows, the buffer should be cleared to trigger the edge.
reader.read_exact(&mut [0; 2]).unwrap();

// If we modify to re-enable the notification, it should be delivered.
poller
.modify_with_mode(
Expand All @@ -267,10 +264,15 @@ fn edge_oneshot_triggered() {
PollMode::EdgeOneshot,
)
.unwrap();
// On Windows, the notification won't be queued up.
// The condition must change while the registration is enabled.

#[cfg(windows)]
writer.write_all(&data).unwrap();
{
// On Windows, the buffer should be cleared to trigger the edge.
reader.read_exact(&mut [0; 2]).unwrap();
// On Windows, the notification won't be queued up.
// The condition must change while the registration is enabled.
writer.write_all(&data).unwrap();
}

events.clear();
poller
Expand Down

0 comments on commit 16b6fa6

Please sign in to comment.