Skip to content

Commit

Permalink
EventLoop::new: Use level-triggered events for inotify fd.
Browse files Browse the repository at this point in the history
The `inotify` crate's `Inotify::read_events` method does not read all available
events from inotify (see hannobraun/inotify-rs#156), only one buffer's worth. Using
level-triggered events tells Mio to report events on the inotify fd until all
events have been read.

Fixes #267.
  • Loading branch information
jimblandy committed Nov 5, 2020
1 parent 4c880c6 commit 3389a1e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

- CHANGE: Report events promptly on Linux, even when many occur in rapid succession. [#268]

[#268]: https://github.com/notify-rs/notify/pull/268

## 4.0.15 (2020-01-07)

- DEPS: Update inotify to 0.7.
Expand Down
5 changes: 4 additions & 1 deletion src/inotify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ impl EventLoop {
&evented_inotify,
INOTIFY,
mio::Ready::readable(),
mio::PollOpt::edge(),
// Use level-sensitive polling (issue #267): `Inotify::read_events`
// only consumes one buffer's worth of events at a time, so events
// may remain in the inotify fd after calling handle_inotify.
mio::PollOpt::level(),
)?;

let event_loop = EventLoop {
Expand Down

0 comments on commit 3389a1e

Please sign in to comment.