galois.runtime
Interface ForeachContext<T>

Type Parameters:
T - type of elements of the Galois iterator
All Known Implementing Classes:
AbstractExecutorContext

public interface ForeachContext<T>

Reference to the context calling GaloisRuntime.foreach(Iterable, util.fn.Lambda2Void, galois.runtime.wl.Priority.Rule).

Provides methods to add to the worklist of the Galois iterator (add(Object)), suspend the current iterator and execute some code serially (suspendWith(Callback)), and finish executing the current iterator without examining all the elements in the worklist (finish()). In all cases, these methods do not appear to take effect until the current iteration commits. In the case of suspendWith(Callback) and finish(), the corresponding effects will eventually happen but not necessarily immediately after the iteration commits.


Method Summary
 void add(T t)
          Adds an element to the worklist of the current iterator.
 void add(T t, byte flags)
          Adds an element to the worklist of the current iterator.
 void finish()
          Finishes executing the current iterator without examining the rest of the elements on its worklist.
 int getIterationId()
           
 int getThreadId()
           
 void suspendWith(Callback call)
          Suspends the current iterator and calls the given function serially.
 

Method Detail

suspendWith

void suspendWith(Callback call)
Suspends the current iterator and calls the given function serially. After the given function completes, the current iterator resumes execution.

Parameters:
call - function to suspend with

finish

void finish()
Finishes executing the current iterator without examining the rest of the elements on its worklist.


add

void add(T t)
Adds an element to the worklist of the current iterator.

Parameters:
t - element to add

add

void add(T t,
         byte flags)
Adds an element to the worklist of the current iterator.

Parameters:
t - element to add
flags - Galois runtime actions (e.g., conflict detection) that need to be executed upon invocation of this method. See MethodFlag

getThreadId

int getThreadId()

getIterationId

int getIterationId()