#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