Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inotify::read_events handles only a buffer's worth of events. #157

Merged
merged 1 commit into from
Nov 5, 2020

Conversation

jimblandy
Copy link
Contributor

Change the documentation of Inotify::read_events to match the actual behavior:
return an iterator over only as many events can fit in the supplied buffer, not
over any available events. Since this is a backwards-incompatible change, bump
the crate version number to 0.9.0.

It would be possible to make Events behave as documented, but it would need to
hold a strong reference to fd and a mutable reference to buffer, and it
seems awkward. The notify crate's use of read_events is easily switched by
requesting level-sensitive notification on the inotify file descriptor, which is
designed for exactly this sort of situation.

@jimblandy jimblandy force-pushed the read-events-doc-fix branch 2 times, most recently from 2b8ebc4 to 15407b1 Compare November 4, 2020 06:52
@hannobraun
Copy link
Owner

Thank you, @jimblandy, good catch there! I wonder if the behavior changed at one point, or if the documentation was always wrong. Oh well.

Fixes hannobraun#156.

Change the documentation of `Inotify::read_events` to match the actual behavior:
return an iterator over only as many events can fit in the supplied buffer, not
over any available events.

It would be possible to make `Events` behave as documented, but it would need to
hold a strong reference to `fd` and a mutable reference to `buffer`, and it
seems awkward. The `notify` crate's use of `read_events` is easily switched by
requesting level-sensitive notification on the inotify file descriptor, which is
designed for exactly this sort of situation.
@jimblandy jimblandy force-pushed the read-events-doc-fix branch from 15407b1 to a3d5f0c Compare November 4, 2020 15:37
@hannobraun hannobraun merged commit 6980cdc into hannobraun:master Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants