summaryrefslogtreecommitdiff
path: root/jobqueue.h
diff options
context:
space:
mode:
authorSøren Sandmann <sandmann@redhat.com>2009-08-30 21:50:51 -0400
committerSøren Sandmann <sandmann@redhat.com>2009-08-30 21:50:51 -0400
commite947945d98e54fbd72c7764418b6556c7df7c7cc (patch)
tree88854705a9aa8b78a65f130f71ad3b1a5b89031b /jobqueue.h
Initial checkinHEADmaster
Diffstat (limited to 'jobqueue.h')
-rw-r--r--jobqueue.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/jobqueue.h b/jobqueue.h
new file mode 100644
index 0000000..9f2c20c
--- /dev/null
+++ b/jobqueue.h
@@ -0,0 +1,26 @@
+#ifndef _JOB_QUEUE_H_
+#define _JOB_QUEUE_H_
+
+#include "executor.h"
+
+typedef struct JobQueue JobQueue;
+
+/* A job queue has the property that no more than one
+ * job will be active at the same time. So if the currently
+ * running task knows that some object will only be touched by itself
+ * and other tasks in the same queue, it doesn't have to lock it.
+ *
+ * Also, the task can safely cancel other jobs in the queue. The
+ * pointer you get back is guaranteed to be valid until the corresponding
+ * task has returned
+ */
+JobQueue *job_queue_new (Executor *executor);
+gpointer job_queue_add (JobQueue *queue,
+ ExecutorJob job,
+ gpointer data);
+void job_queue_remove (JobQueue *queue,
+ gpointer job);
+void job_queue_free (JobQueue *queue);
+
+#endif
+