On Mon, Mar 21, 2016 at 6:09 PM, Andres Freund <and...@anarazel.de> wrote: > On 2016-03-21 11:52:43 +1300, Thomas Munro wrote: >> * I would be interested in writing a kqueue implementation of this for >> *BSD (and MacOSX?) at some point if someone doesn't beat me to it. > > I hoped that somebody would do that - that'd afaics be the only major > API missing.
Here's a first swing at it, though I need to find some spare time to test and figure out if some details like error conditions and EOF are handled correctly. It could in theory minimise the number of syscalls it makes by buffering changes (additions and hopefully one day removals) and then use a single kevent syscall to apply all modifications to the set and begin waiting, but for now it mirrors the epoll code. One user-visible difference compared to epoll/poll/select is that it delivers readable and writable events separately if both conditions are true for a single fd. It builds and appears to work correctly on FreeBSD 10.2 and MacOSX 10.10.2. Sharing this early version in case any BSD users have any feedback. I hope to do some testing this weekend. -- Thomas Munro http://www.enterprisedb.com
kqueue.patch
Description: Binary data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers