mirror of
https://github.com/troglobit/libuev.git
synced 2026-10-01 05:22:25 +07:00
uev_timer_stop(): Check if already stopped to prevent double close()
Both cron and regular timers were closed twice on uev_exit(), first when iterating over all watchers, next after each cb() has run in uev_run(). This patch adds a check if a watcher is active before attempting to stop it (again). Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -166,6 +166,10 @@ 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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user