Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Dec 2005 14:24:20 -0800
From:      John-Mark Gurney <gurney_j@resnet.uoregon.edu>
To:        =?iso-8859-1?Q?Se=E1n_C=2E?= Farley <sean-freebsd@farley.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Number of kevents registered in kqueue
Message-ID:  <20051216222420.GI55657@funkthat.com>
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
Sen C. Farley wrote this message on Fri, Dec 16, 2005 at 16:09 -0600:
> 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.  If
> 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.

Why do you need this?  What is the point of calling kevent if you don't
have an event to wake it up?  Can you give us an example of where you
need to know that there isn't any events in the queue?  (I can't think
of one, since using kqueue w/o events is pointless.)  I can't see how
tracking the count will let you know which events are still in the
kqueue... (second to last sentence)

> 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.

I would think that it would need to be documented when you can't close
a descriptor..  Neither pipe nor socketpair documents that close can
be called on them...

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."



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