Don't call uev_timer_set() when stopping timer, just close() it

The semantics for timerfd in Linux is to use close() to stop,
so no need for the extra overhead with uev_timer_set().

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2018-09-04 21:22:33 +02:00
parent 6d33c56d0f
commit cccaabfad5
-5
View File
@@ -170,17 +170,12 @@ int uev_timer_start(uev_t *w)
*/
int uev_timer_stop(uev_t *w)
{
/* Check if already stopped in uev_run() after cb() or _init() */
if (!_uev_watcher_active(w))
return 0;
/* Stop kernel timer */
uev_timer_set(w, 0, 0);
if (_uev_watcher_stop(w))
return -1;
/* Close timerfd, will have to be reopened again on reset */
close(w->fd);
w->fd = -1;