Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Mar 2012 08:13:13 +0100
From:      Christof Meerwald <cmeerw@cmeerw.org>
To:        freebsd-threads@freebsd.org
Subject:   Re: kevent and multiple worker threads
Message-ID:  <20120321071313.GA30458@edge.cmeerw.net>
In-Reply-To: <20120318213749.GQ843@edge.cmeerw.net>
References:  <20120318213749.GQ843@edge.cmeerw.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120321071313.GA30458>