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

kqueue: remove timeout from unix.Kevent() #480

Merged
merged 5 commits into from Aug 6, 2022
Merged

kqueue: remove timeout from unix.Kevent() #480

merged 5 commits into from Aug 6, 2022

Commits on Apr 21, 2016

  1. kqueue: wait without timeout

    As noted in #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.
    fjl committed Apr 21, 2016
    Copy the full SHA
    0960926 View commit details
    Browse the repository at this point in the history

Commits on Aug 1, 2022

  1. Copy the full SHA
    39a2d75 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    adf163d View commit details
    Browse the repository at this point in the history
  3. Fix up this PR after merge

    The timeout for unix.Kevent() is causing issues; every 100ms it will do a new
    unix.Kevent() syscall, which isn't too efficient: even if you have just one
    change an hour, you will still keep calling kevent() ten times per second,
    resulting in a needlessly high CPU usage.
    
    Without a timeout, kevent() will block indefinitely until there are some events,
    which is much more efficient. We can't just remove the timout however, since we
    can't interrupt the kevent() call on FreeBSD and NetBSD, and it will hang
    forever. This issue is described in more detail here:
    #262 (comment)
    
    To solve this we register a new kevent() with the file descriptor set to the
    closepipe; when this pipe is closed an event is sent and kevent() will stop
    blocking.
    
    This is a rebased version of #124.
    
    Fixes #89
    Fixes #237
    Fixes #333
    Supersedes and closes #124
    Supersedes and closes #262
    Supersedes and closes #334
    arp242 committed Aug 1, 2022
    Copy the full SHA
    fe3d62d View commit details
    Browse the repository at this point in the history

Commits on Aug 6, 2022

  1. Copy the full SHA
    4ea4569 View commit details
    Browse the repository at this point in the history