mirror of
https://github.com/troglobit/libuev.git
synced 2026-10-31 12:20:29 +00:00
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:
1 parent
6d33c56d0f
commit
cccaabfad5
1 file changed
-5
@@ -170,17 +170,12 @@ int uev_timer_start(uev_t *w)
|
|||||||
*/
|
*/
|
||||||
int uev_timer_stop(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))
|
if (!_uev_watcher_active(w))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Stop kernel timer */
|
|
||||||
uev_timer_set(w, 0, 0);
|
|
||||||
|
|
||||||
if (_uev_watcher_stop(w))
|
if (_uev_watcher_stop(w))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Close timerfd, will have to be reopened again on reset */
|
|
||||||
close(w->fd);
|
close(w->fd);
|
||||||
w->fd = -1;
|
w->fd = -1;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user