uloop: allow passing 0 as timeout to uloop_run
[project/libubox.git] / runqueue.c
index 1784e30..a1d0133 100644 (file)
@@ -224,13 +224,15 @@ void runqueue_task_complete(struct runqueue_task *t)
        if (t->running)
                t->q->running_tasks--;
 
+       uloop_timeout_cancel(&t->timeout);
+
        safe_list_del(&t->list);
        t->queued = false;
        t->running = false;
        t->cancelled = false;
        if (t->complete)
                t->complete(q, t);
-       runqueue_start_next(t->q);
+       runqueue_start_next(q);
 }
 
 static void