From: Martin Mares Date: Tue, 12 Dec 2006 20:45:56 +0000 (+0100) Subject: Killed struct work.returned, it was a silly interface. X-Git-Tag: holmes-import~506^2~13^2~194 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=d9d5b4d46efdce006fc484a7964dd6351df94396;p=libucw.git Killed struct work.returned, it was a silly interface. --- diff --git a/lib/asio.c b/lib/asio.c index d495c2d7..710fd2e6 100644 --- a/lib/asio.c +++ b/lib/asio.c @@ -176,7 +176,6 @@ asio_submit(struct asio_request *r) q->running_requests++; r->submitted = 1; r->work.go = asio_handler; - r->work.returned = NULL; work_submit(&q->queue, &r->work); } diff --git a/lib/workqueue.c b/lib/workqueue.c index 3d87a74e..d26ff186 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -172,18 +172,13 @@ work_submit(struct work_queue *q, struct work *w) static struct work * work_do_wait(struct work_queue *q, int try) { - while (q->nr_running) - { - struct work *w = (try ? raw_queue_try_get : raw_queue_get)(&q->finished); - if (!w) - return NULL; - q->nr_running--; - if (w->returned) - w->returned(q, w); - else - return w; - } - return NULL; + if (!q->nr_running) + return NULL; + struct work *w = (try ? raw_queue_try_get : raw_queue_get)(&q->finished); + if (!w) + return NULL; + q->nr_running--; + return w; } struct work * diff --git a/lib/workqueue.h b/lib/workqueue.h index c16904ab..e8c762b2 100644 --- a/lib/workqueue.h +++ b/lib/workqueue.h @@ -66,7 +66,6 @@ struct work { // A single request cnode n; struct work_queue *reply_to; // Where to queue the request when it's finished void (*go)(struct worker_thread *t, struct work *w); // Called inside the worker thread - void (*returned)(struct work_queue *q, struct work *w); // Called when returned back, NULL if work_wait should return }; void worker_pool_init(struct worker_pool *p);