dk.brics.xact.analysis.concurrent
Interface XactTaskRunner

All Known Implementing Classes:
ExecutorTaskRunner, SingleThreadedTaskRunner

public interface XactTaskRunner

Used by the analysis to schedule independant tasks.

A task runner can be in one of two states:

  1. Accepting tasks: Tasks can be added, but are not being executed.
  2. Executing tasks: Tasks are being executed, and new tasks cannot be added.


Method Summary
 void addTask(Runnable runnable)
          Adds a tasks to the task scheduler.
 boolean maybeMultiThreaded()
          Returns true if the scheduler might be multithreaded, or false if it is definitely not multithreaded.
 void runTasks()
          Runs all scheduled tasks and returns when all have completed.
 

Method Detail

addTask

void addTask(Runnable runnable)
Adds a tasks to the task scheduler. The task will not be run until the next invocation of runTasks().

Parameters:
runnable - the task to be executed

maybeMultiThreaded

boolean maybeMultiThreaded()
Returns true if the scheduler might be multithreaded, or false if it is definitely not multithreaded.

If not multithreaded, the analysis can occasionally skip certain tasks that only exist to avoid interference.

Returns:
false if definitely single-threaded, otherwise true

runTasks

void runTasks()
Runs all scheduled tasks and returns when all have completed. The queue of tasks is cleared after this.

Throws a runtime exception if any of the tasks terminated with an unhandled exception.



Copyright © 2005-2011 Aarhus University.