jsync
Class Barrier

java.lang.Object
  extended byjsync.Barrier

public class Barrier
extends java.lang.Object

Class for synchronizing concurrent execution of several threads. By means of this class threads can wait until all of them reach some particular state (barrier) and only after it continue execution.


Constructor Summary
Barrier()
          Default constructor of Barrier object.
Barrier(int n)
          Constructor of Barrier object, which also set number of threads to be meet at barrier.
 
Method Summary
 void reach()
          This method is called by thread reached barrier.
 void reset(int n)
          Reset Barrier object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Barrier

public Barrier()
Default constructor of Barrier object.


Barrier

public Barrier(int n)
Constructor of Barrier object, which also set number of threads to be meet at barrier.

Parameters:
n - specifies number of threads which should reach barrier.
Method Detail

reset

public void reset(int n)
Reset Barrier object.

Parameters:
n - specifies number of threads which should reach barrier.

reach

public void reach()
This method is called by thread reached barrier. Current thread will be suspended until all threads reach the barrier.