From 7a6825716a4bd63601f851f880d40dc6597a72dc Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 21 Sep 2009 04:34:55 +0000 Subject: [PATCH] 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 --- src/apps/debugger/Worker.cpp | 8 ++++---- src/apps/debugger/Worker.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/apps/debugger/Worker.cpp b/src/apps/debugger/Worker.cpp index 5616e934e9..01c8bf650d 100644 --- a/src/apps/debugger/Worker.cpp +++ b/src/apps/debugger/Worker.cpp @@ -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 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; } } diff --git a/src/apps/debugger/Worker.h b/src/apps/debugger/Worker.h index 758153bd6d..455b77e688 100644 --- a/src/apps/debugger/Worker.h +++ b/src/apps/debugger/Worker.h @@ -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);