KQueue and EVFILT_TIMER question
Mel
fbsd.questions at rachie.is-a-geek.net
Wed Feb 20 23:45:48 UTC 2008
Hi,
I'm using a kqueue(2) that installs a timer into the queue when a certain
condition has happened. This timer waits for another condition at intervals
(specifically, it watches for a file to be created). Every 500ms it does a
stat(2) for a given filename and when stat succeeds, I do the following:
changes[0].flags |= EV_ONESHOT;
changes[0].udata = (void*)1;
changes[0].flags |= EV_ADD;
Problem is, that this timer now never disappears, even if I replace changes[0]
with a completely different event (specifically, EVFILT_VNODE on the file we
now know is created).
I suspect that:
"This filter automatically sets the EV_CLEAR flag internally." is the culprit.
So how would I go about terminating the timer? Or is the only way to
initialize it as EV_ONESHOT and keep reinstalling a new one when required? Or
close the kq all together and start a new one? EV_DELETE?
On a related note, is the ident for a timer really used and should I increment
it (all examples I've seen simply set ident to 1).
--
Mel
More information about the freebsd-questions
mailing list