mirror of
https://github.com/troglobit/libuev.git
synced 2026-11-08 16:10:59 +00: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:
1 parent
6cbeb057b8
commit
9df7cbfc52
1 file changed
+4
@@ -166,6 +166,10 @@ 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))
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* Stop kernel timer */
|
/* Stop kernel timer */
|
||||||
uev_timer_set(w, 0, 0);
|
uev_timer_set(w, 0, 0);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user