/* * Copyright 2013, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: * Ingo Weinhold */ #ifndef JOB_QUEUE_H #define JOB_QUEUE_H #include #include "Job.h" class JobQueue { public: JobQueue(); ~JobQueue(); status_t Init(); void Close(); bool QueueJob(Job* job); // acquires a reference, if successful Job* DequeueJob(); // returns a reference private: typedef DoublyLinkedList JobList; private: pthread_mutex_t fMutex; pthread_cond_t fNewJobCondition; bool fMutexInitialized; bool fNewJobConditionInitialized; JobList fJobs; bool fClosed; }; #endif // JOB_QUEUE_H