decaf::util::concurrent::CountDownLatch Class Reference

#include <src/main/decaf/util/concurrent/CountDownLatch.h>

Public Member Functions

 CountDownLatch (int count)
 Constructor.
virtual ~CountDownLatch ()
virtual void await ()
 Causes the current thread to wait until the latch has counted down to zero, unless the thread is interrupted.
virtual bool await (long long timeOut)
 Causes the current thread to wait until the latch has counted down to zero, unless the thread is interrupted, or the specified waiting time elapses.
virtual bool await (long long timeout, const TimeUnit &unit)
 Causes the current thread to wait until the latch has counted down to zero, unless the thread is interrupted, or the specified waiting time elapses.
virtual void countDown ()
 Counts down the latch, releasing all waiting threads when the count hits zero.
virtual int getCount () const
 Gets the current count.
virtual std::string toString () const
 Returns the string representation of this latch, includes the current count value at the time of calling.

Constructor & Destructor Documentation

decaf::util::concurrent::CountDownLatch::CountDownLatch ( int  count  ) 

Constructor.

Parameters:
count - number to count down from.
virtual decaf::util::concurrent::CountDownLatch::~CountDownLatch (  )  [virtual]

Member Function Documentation

virtual bool decaf::util::concurrent::CountDownLatch::await ( long long  timeout,
const TimeUnit unit 
) [virtual]

Causes the current thread to wait until the latch has counted down to zero, unless the thread is interrupted, or the specified waiting time elapses.

If the current count is zero then this method returns immediately with the value true.

If the current count is greater than zero then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happen:

* The count reaches zero due to invocations of the countDown() method; or * Some other thread interrupts the current thread; or * The specified waiting time elapses.

If the count reaches zero then the method returns with the value true.

If the current thread:

* has its interrupted status set on entry to this method; or * is interrupted while waiting,

then InterruptedException is thrown and the current thread's interrupted status is cleared.

If the specified waiting time elapses then the value false is returned. If the time is less than or equal to zero, the method will not wait at all.

Parameters:
timeout - Time to wait for the count to reach zero.
unit - The units that the timeout specifies.
Exceptions:
InterruptedException - if the current thread is interrupted while waiting.
Exception - if any other error occurs.
virtual bool decaf::util::concurrent::CountDownLatch::await ( long long  timeOut  )  [virtual]

Causes the current thread to wait until the latch has counted down to zero, unless the thread is interrupted, or the specified waiting time elapses.

If the current count is zero then this method returns immediately with the value true.

If the current count is greater than zero then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happen:

* The count reaches zero due to invocations of the countDown() method; or * Some other thread interrupts the current thread; or * The specified waiting time elapses.

If the count reaches zero then the method returns with the value true.

If the current thread:

* has its interrupted status set on entry to this method; or * is interrupted while waiting,

then InterruptedException is thrown and the current thread's interrupted status is cleared.

If the specified waiting time elapses then the value false is returned. If the time is less than or equal to zero, the method will not wait at all.

Parameters:
timeout - Time in milliseconds to wait for the count to reach zero.
Exceptions:
InterruptedException - if the current thread is interrupted while waiting.
Exception - if any other error occurs.
virtual void decaf::util::concurrent::CountDownLatch::await (  )  [virtual]

Causes the current thread to wait until the latch has counted down to zero, unless the thread is interrupted.

If the current count is zero then this method returns immediately.

If the current count is greater than zero then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of two things happen:

* The count reaches zero due to invocations of the countDown() method; or * Some other thread interrupts the current thread.

If the current thread:

* has its interrupted status set on entry to this method; or * is interrupted while waiting,

then InterruptedException is thrown and the current thread's interrupted status is cleared.

Exceptions:
InterruptedException - if the current thread is interrupted while waiting.
Exception - if any other error occurs.
virtual void decaf::util::concurrent::CountDownLatch::countDown (  )  [virtual]

Counts down the latch, releasing all waiting threads when the count hits zero.

virtual int decaf::util::concurrent::CountDownLatch::getCount (  )  const [virtual]

Gets the current count.

Returns:
int count value
virtual std::string decaf::util::concurrent::CountDownLatch::toString (  )  const [virtual]

Returns the string representation of this latch, includes the current count value at the time of calling.

Returns:
string describing this CountDownLatch instance.

The documentation for this class was generated from the following file:

Generated on 1 Dec 2014 for activemq-cpp-3.8.2 by  doxygen 1.6.1