Nested WaitForJob()s didn't work correctly, when the job an outer

_ProcessJobs() loop waited for was processed by an inner one. Instead the loops
now check the state of the waiting job -- it will be changed from waiting as
soon as the job it waits for is done.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33216 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-09-21 04:34:55 +00:00
parent 3bd94918ed
commit 7a6825716a
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -351,7 +351,7 @@ Worker::WaitForJob(Job* waitingJob, const JobKey& key)
// a job waiting for a dependency won't abort the job before the dependency
// is done.
locker.Unlock();
_ProcessJobs(job);
_ProcessJobs(waitingJob);
locker.Lock();
// ignore the actual wait status when the game is over anyway
@@ -384,7 +384,7 @@ Worker::_WorkerLoop()
void
Worker::_ProcessJobs(Job* finalJob)
Worker::_ProcessJobs(Job* waitingJob)
{
while (true) {
AutoLocker<Worker> locker(this);
@@ -407,7 +407,7 @@ Worker::_ProcessJobs(Job* finalJob)
while (Job* job = fAbortedJobs.RemoveHead()) {
_FinishJob(job);
if (job == finalJob)
if (waitingJob != NULL && waitingJob->State() != JOB_STATE_WAITING)
break;
}
@@ -426,7 +426,7 @@ Worker::_ProcessJobs(Job* finalJob)
_FinishJob(job);
if (job == finalJob)
if (waitingJob != NULL && waitingJob->State() != JOB_STATE_WAITING)
break;
}
}
+1 -1
View File
@@ -182,7 +182,7 @@ private:
static status_t _WorkerLoopEntry(void* data);
status_t _WorkerLoop();
void _ProcessJobs(Job* finalJob);
void _ProcessJobs(Job* waitingJob);
void _AbortJob(Job* job, bool removeFromTable);
void _FinishJob(Job* job);