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
kqueue improvements #24
Comments
I tried a nil timeout but there is more work involved. Currently |
FreeBSD 10.0 behaves a bit differently:
It's not a huge deal if we're calling Close() before shutting down the app, but if not, then the Read goroutine will sit there blocking until it gets another event to send over the channel. And if I do a proper cleanup to DELETE the events, that next event will never come. |
When registering file descriptors to watch, this could be useful if registering multiple watches at once (such as all the files in a directory):
Otherwise I don't think I need to check for EV_ERROR. Fsnotify was doing this check, but eventlist was nil, so it should never be the case. |
When watching a directory with kqueue it reports:
fsnotify currently adds to this:
|
In relation to #16, I was thinking of actually having an event of "something happened in this directory, but we don't know what." Then the scanning and comparing of the files in a directory could be a separate utility function instead of built into But there is still the problem of touching files not reporting any event at all. As well as making the calling code different for kqueue. |
As noted in fsnotify#24, reading from the kqueue won't unblock when it is closed on all platforms. This commit solves the issue by additionally watching on a pipe which is closed when Watcher is closed. This makes the read timeout unnessary.
As noted in fsnotify#24, reading from the kqueue won't unblock when it is closed on all platforms. This commit solves the issue by additionally watching on a pipe which is closed when Watcher is closed. This makes the read timeout unnessary.
As noted in fsnotify#24, reading from the kqueue won't unblock when it is closed on all platforms. This commit solves the issue by additionally watching on a pipe which is closed when Watcher is closed. This makes the read timeout unnessary.
As noted in fsnotify#24, reading from the kqueue won't unblock when it is closed on all platforms. This commit solves the issue by additionally watching on a pipe which is closed when Watcher is closed. The read timeout is no longer necessary.
As noted in fsnotify#24, reading from the kqueue won't unblock when it is closed on all platforms. This commit solves the issue by additionally watching on a pipe which is closed when Watcher is closed. The read timeout is no longer necessary.
As noted in fsnotify#24, reading from the kqueue won't unblock when it is closed on all platforms. This commit solves the issue by additionally watching on a pipe which is closed when Watcher is closed. The read timeout is no longer necessary.
I always wondered how it deals with atomic writes as i cannot get it to fire again when such a write happens. |
Not really worth optimizing IMO. |
What have I learned from experimenting with kqueue directly (primarily on OS X)? #23
fsnotify doesn't watch for Extend, Link or Revoke events (tracked in Support additional event types #519 now).
fsnotify has a 100ms timeout on reads, but instead we may be able to just block until kqueue has events available (nil timespec). this could save a little CPU time when idle, see: Increase syscall timeouts to decrease CPU usage? howeyc/fsnotify#58
fsnotify could add multiple file descriptors at once (such as all files in a directory), which may be a little more efficient then adding each one individually.
investigated
Udata
which C programs sometimes use to point to the watched filename, but it's probably not worthwhile from Go (and NetBSD defines Udata differently than the other BSDs).Other improvements are specific to fsnotify, such as less mutexes #13 and bug fixes #14.
The text was updated successfully, but these errors were encountered: