Registering and Handling Events
kevent() registers your interest in specific filters and events with a kqueue, and it is also the function used to block on a kqueue waiting for event notifications. The signature of kevent() is a bit long because it lets you do both operations at the same time.
int kevent (int kqueue,
const struct kevent *changeList, int numChanges,
struct kevent *eventList, int numEvents,
const struct timespec *timeout);
The first argument to kevent() is the kqueue you want to manipulate. changeList holds the set of new events for the kqueue to monitor, as well as any changes to events the kqueue is already monitoring. If changeList is non-NULL and numChanges is greater than zero, then the events in changeList will be applied ...
Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.