selectors: Plumb in kqueue user events instead of pipes for custom events
This enables using kQueue EVFILT_USER for much faster user triggered events on MacOSX and likely *BSDs. Currently gated behind a new kqueue flag -d:kqueueUserEvent.
It's a little tricky to make it so the trigger function works on a kqueue custom event. I handled this by only enabling triggering once a custom event has been registered with a selector and is given that selector's kqueue FD. This may cause a bit of a race condition when closing that selector, though similar issues occur with pipe based events as well.
There's a bit of a question I had about whether a SelectEvent should support being added to multiple selectors. The current implementation only allows a user event to be registered with a single selector. On Linux SelectEvent's use eventfd and should work fine with multiple selectors & threads. Given that, it might be best to enable the kqueue-based user events to be registered with multiple selectors. That'd require using a sharedArray of kqueue FD's.
Note, I'd like to add a test before this is merged. However I wanted to open the PR so I could get feedback on whether multiple selector's should be supported.
This pull request has been automatically marked as stale because it has not had recent activity. If you think it is still a valid PR, please rebase it on the latest devel; otherwise it will be closed. Thank you for your contributions.
This pull request is stale because it has been open for 1 year with no activity. Contribute more commits on the pull request and rebase it on the latest devel, or it will be closed in 30 days. Thank you for your contributions.
This pull request has been marked as stale and closed due to inactivity after 395 days.