JobQueue: fixed leak, notification, added Pop() variant.
* Was leaking fQueuedJobs on destruction. * fHaveRunnableJobSem implementation was not completed; it was never released. * Added Pop() variant that is a bit more flexible, and allows for a timeout as well as waiting even when the queue is empty, and can return a status code.
This commit is contained in:
@@ -30,8 +30,12 @@ public:
|
||||
// gives up ownership
|
||||
|
||||
BJob* Pop();
|
||||
status_t Pop(bigtime_t timeout, bool returnWhenEmpty,
|
||||
BJob** _job);
|
||||
// caller owns job
|
||||
|
||||
size_t CountJobs() const;
|
||||
|
||||
void Close();
|
||||
|
||||
private:
|
||||
@@ -49,7 +53,7 @@ private:
|
||||
void _RequeueDependantJobsOf(BJob* job);
|
||||
void _RemoveDependantJobsOf(BJob* job);
|
||||
|
||||
BLocker fLock;
|
||||
mutable BLocker fLock;
|
||||
uint32 fNextTicketNumber;
|
||||
JobPriorityQueue* fQueuedJobs;
|
||||
sem_id fHaveRunnableJobSem;
|
||||
|
||||
Reference in New Issue
Block a user