[workqueue] Update workqueue users callbacks to additional arguments
2005-11-14 Paul Jakma <paul.jakma@sun.com>
* (general) pass struct work-queue to callback functions.
* workqueue.h: (struct work_queue) move the state flag
variables to end.
Add an opaque pointer to spec, for user-data global to the
queue.
Pass reference to work_queue to all callbacks.
* workqueue.c: (work_queue_item_remove) pass ref to workqueue
to user callbacks.
(work_queue_run) ditto.
diff --git a/lib/workqueue.c b/lib/workqueue.c
index c2ff10d..0c61f5c 100644
--- a/lib/workqueue.c
+++ b/lib/workqueue.c
@@ -147,7 +147,7 @@
/* call private data deletion callback if needed */
if (wq->spec.del_item_data)
- wq->spec.del_item_data (item->data);
+ wq->spec.del_item_data (wq, item->data);
list_delete_node (wq->items, ln);
work_queue_item_free (item);
@@ -284,7 +284,7 @@
/* run and take care of items that want to be retried immediately */
do
{
- ret = wq->spec.workfunc (item->data);
+ ret = wq->spec.workfunc (wq, item->data);
item->ran++;
}
while ((ret == WQ_RETRY_NOW)