summaryrefslogtreecommitdiff
path: root/lib/workqueue.h
diff options
context:
space:
mode:
authorpaul <paul>2005-11-14 14:46:35 +0000
committerpaul <paul>2005-11-14 14:46:35 +0000
commit889e9311e5c900ce24eecf00fcb5b8b9d51bb020 (patch)
treed5f3ebd53e4185157027becf01d67ace5400e24d /lib/workqueue.h
parent0fb58d5d7993b638fc46085944d17d3a54d66046 (diff)
[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.
Diffstat (limited to 'lib/workqueue.h')
-rw-r--r--lib/workqueue.h25
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/workqueue.h b/lib/workqueue.h
index 15c72f62..0a398ded 100644
--- a/lib/workqueue.h
+++ b/lib/workqueue.h
@@ -57,26 +57,31 @@ enum work_queue_flags
struct work_queue
{
- /* Everything but the specification struct is private */
+ /* Everything but the specification struct is private
+ * the following may be read
+ */
struct thread_master *master; /* thread master */
struct thread *thread; /* thread, if one is active */
char *name; /* work queue name */
- char status; /* status */
-#define WQ_STATE_FLOODED (1 << 0)
- enum work_queue_flags flags; /* flags */
/* Specification for this work queue.
* Public, must be set before use by caller. May be modified at will.
*/
struct {
- /* work function to process items with */
- wq_item_status (*workfunc) (void *);
+ /* optional opaque user data, global to the queue. */
+ void *data;
+
+ /* work function to process items with:
+ * First argument is the workqueue queue.
+ * Second argument is the item data
+ */
+ wq_item_status (*workfunc) (struct work_queue *, void *);
/* error handling function, optional */
void (*errorfunc) (struct work_queue *, struct work_queue_item *);
/* callback to delete user specific item data */
- void (*del_item_data) (void *);
+ void (*del_item_data) (struct work_queue *, void *);
/* completion callback, called when queue is emptied, optional */
void (*completion_func) (struct work_queue *);
@@ -110,6 +115,12 @@ struct work_queue
unsigned int granularity;
unsigned long total;
} cycles; /* cycle counts */
+
+ /* private state */
+ enum work_queue_flags flags; /* user set flag */
+ char status; /* internal status */
+#define WQ_STATE_FLOODED (1 << 0)
+
};
/* User API */