Reland "Reimplement base::WaitableEvent with a kqueue on Mac."
This is a reland of 2096391c Original change's description: > Reimplement base::WaitableEvent with a kqueue on Mac. > > 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/553497 > Reviewed-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} Bug: 681167 Change-Id: I1b0296022f7bd1a31b074fbbb551bccc3b28d05b Reviewed-on: https://chromium-review.googlesource.com/568642Reviewed-by:Mark Mentovai <mark@chromium.org> Commit-Queue: Robert Sesek <rsesek@chromium.org> Cr-Commit-Position: refs/heads/master@{#486449}
Showing
Please register or sign in to comment