Skip to content

kqueue improvements #24

@nathany

Description

@nathany

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

    • closing the kq (on OS X) results in the read failing with Kevent: interrupted system call, so blocking in a goroutine shouldn't delay shutdown.
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions