Date: Thu, 21 Feb 2008 00:45:45 +0100 From: Mel <fbsd.questions@rachie.is-a-geek.net> To: freebsd-questions@freebsd.org Subject: KQueue and EVFILT_TIMER question Message-ID: <200802210045.45991.fbsd.questions@rachie.is-a-geek.net>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802210045.45991.fbsd.questions>