Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/lamont/src/compiler/c-target/fragments/par-kdtree.in
ViewVC logotype

Diff of /branches/lamont/src/compiler/c-target/fragments/par-kdtree.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2576, Wed Apr 2 04:36:30 2014 UTC revision 2577, Mon Apr 7 14:35:02 2014 UTC
# Line 238  Line 238 
238          while(!workerArg->sched->buildIsDone)          while(!workerArg->sched->buildIsDone)
239          {          {
240          //Wait until a task is assigned to the worker          //Wait until a task is assigned to the worker
241            if(!workerArg->isIdle) {
242              pthread_mutex_lock (&workerArg->sched->lock);              pthread_mutex_lock (&workerArg->sched->lock);
243              if(!workerArg->sched->buildIsDone){              if(!workerArg->sched->buildIsDone || !workerArg->isIdle){
244                  if(workerArg->sched->numRunning - 1 > 0 || workerArg->sched->jobsRunning > 0)                  if(workerArg->sched->numRunning - 1 > 0 || workerArg->sched->jobsRunning > 0)
245                  {                  {
                    workerArg->isIdle = true;  
246                     workerArg->sched->numRunning-=1;                     workerArg->sched->numRunning-=1;
247                         pthread_cond_wait (&workerArg->runWait,&workerArg->sched->lock);                         pthread_cond_wait (&workerArg->runWait,&workerArg->sched->lock);
248                     if(!workerArg->isIdle)                     if(!workerArg->isIdle)
# Line 259  Line 259 
259                  workerArg->sched->numRunning+=1;                  workerArg->sched->numRunning+=1;
260              }              }
261              pthread_mutex_unlock (&workerArg->sched->lock);              pthread_mutex_unlock (&workerArg->sched->lock);
262            }
263              if(workerArg->sched->buildIsDone){              if(workerArg->sched->buildIsDone){
264                          workerArg->isIdle = false;                          workerArg->isIdle = false;
265                  break;                  break;
# Line 310  Line 310 
310                     pthread_cond_signal (&workerArg->done);                     pthread_cond_signal (&workerArg->done);
311                 pthread_mutex_unlock (&workerArg->lock);                 pthread_mutex_unlock (&workerArg->lock);
312          }          }
313            workerArg->isIdle = true;
314          }          }
315  }  }
316  /* Finds the median strand in an array of strands based on the given axis*/  /* Finds the median strand in an array of strands based on the given axis*/

Legend:
Removed from v.2576  
changed lines
  Added in v.2577

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0