-
Robert Sesek authored
For a single WaitableEvent, a custom EVFILT_USER kevent is used to wait and signal. This replaces the default POSIX implementation that uses a pthread_cond_t and a boolean flag. To implement WaitMany, a new kqueue is created to wait on all the individual WaitableEvent's kqueue descriptor. This replaces a complex locking algorithm used in the default POSIX implementation. For the asynchronous WaitableEventWatcher, a TYPE_READ dispatch_source_t is used to watch the WaitableEvent's kqueue. This replaces the POSIX implementation of a reference-counted list of async watchers guarded by a lock. Microbenchmarks show that the kqueue implementation is significantly faster in most cases. The one potential drawback is hitting the low RLIMIT_NOFILE on macOS, since each WaitableEvent and WaitableEventWatcher requires a new descriptor. Bug: 681167 Change-Id: I135012fdd25e547ffb911fc7adc97c203df38241 Reviewed-on: https://chromium-review.googlesource.com/553497Reviewed-by:
Robert Liao <robliao@chromium.org> Reviewed-by:
Mark Mentovai <mark@chromium.org> Commit-Queue: Robert Sesek <rsesek@chromium.org> Cr-Commit-Position: refs/heads/master@{#485788}
2096391c