Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Mar 2015 07:33:06 +0100
From:      Ivan Radovanovic <radovanovic@gmail.com>
To:        freebsd-hackers@FreeBSD.org
Subject:   kevent behavior
Message-ID:  <550A6DA2.1070004@gmail.com>

next in thread | raw e-mail | index | archive | help
Hi guys,

Is there defined (and guaranteed) behavior of kevent if kqueue FD is 
being closed while blocking kevent call is in progress?

Possible scenario would be like this:

Thread 1:
...
kfd = kqueue();
...
// create second thread afterwords
// and do blocking wait for events
result = kevent(kfd, changelist, nchanges, eventlist, nevents, NULL);
if (result == -1)
	// check if there was request to stop listening for events


Thread 2:
// do something
// then close kqueue's fd
close(kfd);


I am asking this because file watcher implementation for mono is 
implemented that way (which I find nicer than using timeout), but this 
is apparently based on expected kevent behavior under Darwin, and I 
can't find any mention that in FreeBSD kevent is going to behave the 
same way (at least not on kqueue(2) manual page)

Kind regards,
Ivan



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