Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Dec 2005 23:36:26 +0100
From:      =?UTF-8?B?VsOhY2xhdiBIYWlzbWFu?= <V.Haisman@sh.cvut.cz>
To:        =?UTF-8?B?IlNlw6FuIEMuIEZhcmxleSI=?= <sean-freebsd@farley.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Number of kevents registered in kqueue
Message-ID:  <43A3416A.2000407@sh.cvut.cz>
In-Reply-To: <20051216155717.W4815@thor.farley.org>
References:  <20051216155717.W4815@thor.farley.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigFD91E7217177B7708B5ABC99
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



Se=C3=A1n C. Farley wrote:
> I may have missed it in the man page, but I am unable to find a way to
> determine how many kevents are currently registered within a kqueue.  I=
f
> there is no method for a count, how about a way to find if a kqueue is
> empty or not.  Besides tracking what events are still within a kqueue,
> this would make for an easier way to write an event loop.  Currently,
> calling kevent() on an empty kqueue will still block.
>=20
> Also, I recommend that the man page mention that a kqueue may be
> close(2)'d.  The only reference that it can be is that the manual page
> says the kqueue() call returns a descriptor.
>=20
> Se=C3=A1n
I was working with it recently and my understanding is that if you want
to retrieve any events and not block if there are none then you should
give it zeroed struct timespec. Quote from the man page:

"If timeout is a NULL pointer, kevent() waits indefinitely.  To effect a
poll, the timeout argument should be non-NULL, pointing to a zero-valued
timespec structure."


Vaclav Haisman


--------------enigFD91E7217177B7708B5ABC99
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iQEVAwUBQ6NBcG56zbtzMDG0AQJOSggAjrORSDYwonOivLSyo5rS0VjAZU2roguZ
wAmKMV+uWpn5+bPW4QQoXBMOkhSt/N3n1uT2qu+KfAIq6BuvBZLhterpWwoqQAaU
YNuPikYTRKy0HgC8nrEduBpsCrmKIsVjTdKtLQzZB6+xVjx3o60yV0RDhG2srXK/
fH4j8ZhzMhq2esvjUz0FAuU9r+y7jvY7C+AtLealqFYSkKuHEG597tCjgGpehUxk
iUa3OFXnpAamMokDAYgMyIuTb17n8XXNihTwJ585/W1QzYClpxOwPetS1UZaa5KY
b0nQ+d43TfshJJGZ1u9gVSd2xwynjMgcXH2OQ1vsjK3rpsR+jCbEjw==
=UKPh
-----END PGP SIGNATURE-----

--------------enigFD91E7217177B7708B5ABC99--



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