4 * @brief Interface of job_queue_t.
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 #include <queues/jobs/job.h>
29 typedef struct job_queue_t job_queue_t
;
34 * Although the job-queue is based on a linked_list_t
35 * all access functions are thread-save implemented.
42 * @brief returns number of jobs in queue
44 * @param job_queue_t calling object
45 * @returns number of items in queue
47 int (*get_count
) (job_queue_t
*job_queue
);
50 * @brief get the next job from the queue
52 * If the queue is empty, this function blocks until a job can be returned.
53 * After using, the returned job has to get destroyed by the caller.
55 * @param job_queue_t calling object
56 * @param[out] job pointer to a job pointer where to job is returned to
59 job_t
*(*get
) (job_queue_t
*job_queue
);
62 * @brief adds a job to the queue
64 * This function is non blocking and adds a job_t to the list.
65 * The specific job object has to get destroyed by the thread which
68 * @param job_queue_t calling object
69 * @param job job to add to the queue (job is not copied)
71 void (*add
) (job_queue_t
*job_queue
, job_t
*job
);
74 * @brief destroys a job_queue object
76 * @warning The caller of this function has to make sure
77 * that no thread is going to add or get a job from the job_queue
78 * after calling this function.
80 * @param job_queue_t calling object
82 void (*destroy
) (job_queue_t
*job_queue
);
86 * @brief Creates an empty job_queue.
88 * @return job_queue_t empty job_queue
92 job_queue_t
*job_queue_create();
94 #endif /*JOB_QUEUE_H_*/