kevent and multiple worker threads
Christof Meerwald
cmeerw at cmeerw.org
Wed Mar 21 07:13:17 UTC 2012
On Sun, Mar 18, 2012 at 10:37:49PM +0100, Christof Meerwald wrote:
> I am trying to figure out how kqueue/kevent works in a multi-threaded
> environment. So I have created a small test program
> (http://svn.cmeerw.net/src/nginetd/trunk/test/kqtest.cc) that creates
> a socketpair and send 4-byte messages between the 2 sockets. There is
> only ever 1 message in transit, but there can be multiple threads
> waiting for event notification using kevent.
Ok, it looks like it has something to do with the size of the
eventlist I am passing in - if I call kevent with nevents=16 instead
of nevents=1 I get much more reasonable results on FreeBSD. The
surprising thing here, of course, is that kevent will only ever return
1 event (as there is only 1 message in transit), so I am not sure why
the size of the eventlist would make a difference.
Christof
--
http://cmeerw.org sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org xmpp:cmeerw at cmeerw.org
More information about the freebsd-threads
mailing list