macports-dev Digest, Vol 152, Issue 1

Clemens Lang cal at macports.org
Mon Apr 1 20:04:12 UTC 2019


Hi Mihir,

On Mon, Apr 01, 2019 at 09:13:42PM +0530, Mihir Luthra wrote:
> Actually my question is what is the purpose of the call (1), because
> till what I understood, kevent(2) only lets the program proceed
> further when it will return and it only returns when it detects an
> event. Call (1) is supposed to detect a read event. I am asking where
> exactly that read event happens that makes that kevent return.

See the manpage for kevent(2), specifically the section on EV_RECEIPT.
Since this call passes EV_RECEIPT, no events are drained from the queue
and the call does not block. You'll see the same pattern multiple times:
A call to EV_SET with EV_ADD | EV_RECEIPT followed by a call to
kevent(2) with a pointer to the struct kevent and eventually a call to
kevent(2) without a pointer to a struct kevent that will process the
pending events.


HTH,
Clemens


More information about the macports-dev mailing list