X-Git-Url: http://git.archive.openwrt.org/?p=project%2Flibubox.git;a=blobdiff_plain;f=runqueue.c;h=189a00555e12cb43a087dce5d2fd4783e1e23344;hp=5cc37bbe70adbd6531d1075705fd5d2dcabd9c40;hb=13a9b7c709ed78ec10a3fec2b631c2c3cfa2792f;hpb=cb6c1718e711db77f7b6a06c8bc51fe392509bbc diff --git a/runqueue.c b/runqueue.c index 5cc37bb..189a005 100644 --- a/runqueue.c +++ b/runqueue.c @@ -203,6 +203,8 @@ void runqueue_resume(struct runqueue *q) void runqueue_task_complete(struct runqueue_task *t) { + struct runqueue *q = t->q; + if (!t->queued) return; @@ -213,6 +215,8 @@ void runqueue_task_complete(struct runqueue_task *t) t->queued = false; t->running = false; t->cancelled = false; + if (t->complete) + t->complete(q, t); runqueue_start_next(t->q); } @@ -220,11 +224,8 @@ static void __runqueue_proc_cb(struct uloop_process *p, int ret) { struct runqueue_process *t = container_of(p, struct runqueue_process, proc); - struct runqueue *q = t->task.q; runqueue_task_complete(&t->task); - if (t->complete) - t->complete(q, t, ret); } void runqueue_process_cancel_cb(struct runqueue *q, struct runqueue_task *t, int type) @@ -243,7 +244,6 @@ void runqueue_process_kill_cb(struct runqueue *q, struct runqueue_task *t) uloop_process_delete(&p->proc); kill(p->proc.pid, SIGKILL); - __runqueue_proc_cb(&p->proc, -1); } static const struct runqueue_task_type runqueue_proc_type = {