JobQueue::AddJob() returns error on lock failure.

* If the lock could not be obtained, it will now return B_ERROR
  instead of B_OK.
This commit is contained in:
Axel Dörfler
2015-07-22 20:41:41 +02:00
parent ac0a462fba
commit c7c1744b2e
+3 -2
View File
@@ -84,7 +84,9 @@ JobQueue::AddJob(BJob* job)
return B_NO_INIT; return B_NO_INIT;
BAutolock lock(&fLock); BAutolock lock(&fLock);
if (lock.IsLocked()) { if (!lock.IsLocked())
return B_ERROR;
try { try {
if (!fQueuedJobs->insert(job).second) if (!fQueuedJobs->insert(job).second)
return B_NAME_IN_USE; return B_NAME_IN_USE;
@@ -97,7 +99,6 @@ JobQueue::AddJob(BJob* job)
job->AddStateListener(this); job->AddStateListener(this);
if (job->IsRunnable()) if (job->IsRunnable())
release_sem(fHaveRunnableJobSem); release_sem(fHaveRunnableJobSem);
}
return B_OK; return B_OK;
} }