cgl.hpsearch.common.sync
Class Barrier
java.lang.Object
cgl.hpsearch.common.sync.Barrier
- public class Barrier
- extends Object
Thread Synchronization Utility.
Creates a barrier for a group of threads where all threads wait. When all threads reach the
barrier then the waiting threads resume.
- Author:
- Harshawardhan Gadgil
|
Constructor Summary |
Barrier(int _numThreads)
Constructs a barrier specifying the number of threads that should join at this barrier. |
|
Method Summary |
void |
reset(int _numThreads)
|
void |
waitAt()
This method is called by thread reached barrier. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Barrier
public Barrier(int _numThreads)
- Constructs a barrier specifying the number of threads that should join at this barrier.
- Parameters:
_numThreads - Number of threads which should reach barrier.
waitAt
public void waitAt()
- This method is called by thread reached barrier. Current thread will be suspended until all
threads reach the barrier.
reset
public void reset(int _numThreads)