Logo Search packages:      
Sourcecode: scala version File versions  Download package

void scala::actors::FJTaskRunner::run (  )  [inline]

Main runloop

Definition at line 799 of file FJTaskRunner.java.

References COLLECT_STATS, deq, scala::actors::IFJTaskRunnerGroup::getEntryQueue(), group, scala::actors::FJTask::isDone(), pop(), scala::actors::LinkedQueue::put(), runs, scanWhileIdling(), scala::actors::FJTask::setDone(), scala::actors::IFJTaskRunnerGroup::setInactive(), and take().

                    {
    try{ 
      while (!interrupted()) {
        FJTask task = pop();
        if (task != null) {
          if (!task.isDone()) {
            // inline FJTask.invoke
            if (COLLECT_STATS) ++runs;
            task.run(); 
            task.setDone(); 
          }
        }
        else
          scanWhileIdling();
      }
      // check for suspending
      if (suspending) {
          synchronized(this) {
              // move all local tasks to group-wide entry queue
              for (int i = 0; i < deq.length; ++i) {
                  synchronized(group) {
                      try {
                          FJTask task = (FJTask)deq[i].take();
                          if (task != null)
                              group.getEntryQueue().put(task);
                      } catch (InterruptedException ie) {
                          System.err.println("Suspend: when transferring task to entryQueue: "+ie);
                      }
                  }
              }
          }
      }
    }
    finally {
      group.setInactive(this);
    }
  }


Generated by  Doxygen 1.6.0   Back to index