activemq-cpp-3.3.0
|
Mutex object that offers recursive support on all platforms as well as providing the ability to use the standard wait / notify pattern used in languages like Java. More...
#include <src/main/decaf/util/concurrent/Mutex.h>
Public Member Functions | |
Mutex () | |
Mutex (const std::string &name) | |
virtual | ~Mutex () |
std::string | getName () const |
std::string | toString () const |
virtual void | lock () |
Locks the object. | |
virtual bool | tryLock () |
Attempts to Lock the object, if the lock is already held by another thread than this method returns false. | |
virtual void | unlock () |
Unlocks the object. | |
virtual void | wait () |
Waits on a signal from this object, which is generated by a call to Notify. | |
virtual void | wait (long long millisecs) |
Waits on a signal from this object, which is generated by a call to Notify. | |
virtual void | wait (long long millisecs, int nanos) |
Waits on a signal from this object, which is generated by a call to Notify. | |
virtual void | notify () |
Signals a waiter on this object that it can now wake up and continue. | |
virtual void | notifyAll () |
Signals the waiters on this object that it can now wake up and continue. |
Mutex object that offers recursive support on all platforms as well as providing the ability to use the standard wait / notify pattern used in languages like Java.
decaf::util::concurrent::Mutex::Mutex | ( | ) |
decaf::util::concurrent::Mutex::Mutex | ( | const std::string & | name | ) |
virtual decaf::util::concurrent::Mutex::~Mutex | ( | ) | [virtual] |
std::string decaf::util::concurrent::Mutex::getName | ( | ) | const |
virtual void decaf::util::concurrent::Mutex::lock | ( | ) | [virtual] |
Locks the object.
RuntimeException | if an error occurs while locking the object. |
Implements decaf::util::concurrent::Synchronizable.
Referenced by decaf::util::StlQueue< T >::lock(), decaf::util::StlMap< std::string, cms::Topic * >::lock(), decaf::util::concurrent::CopyOnWriteArrayList< ServiceListener * >::lock(), decaf::util::concurrent::ConcurrentStlMap< Pointer< ProducerId >, Pointer< ProducerState >, ProducerId::COMPARATOR >::lock(), and decaf::util::AbstractCollection< cms::Connection * >::lock().
virtual void decaf::util::concurrent::Mutex::notify | ( | ) | [virtual] |
Signals a waiter on this object that it can now wake up and continue.
Must have this object locked before calling.
IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. |
RuntimeException | if an error occurs while notifying one of the waiting threads. |
Implements decaf::util::concurrent::Synchronizable.
Referenced by decaf::util::concurrent::LinkedBlockingQueue< E >::clear(), decaf::util::StlQueue< T >::notify(), decaf::util::StlMap< std::string, cms::Topic * >::notify(), decaf::util::concurrent::CopyOnWriteArrayList< ServiceListener * >::notify(), decaf::util::concurrent::ConcurrentStlMap< Pointer< ProducerId >, Pointer< ProducerState >, ProducerId::COMPARATOR >::notify(), decaf::util::AbstractCollection< cms::Connection * >::notify(), decaf::util::concurrent::LinkedBlockingQueue< E >::offer(), decaf::util::concurrent::LinkedBlockingQueue< E >::poll(), decaf::util::concurrent::LinkedBlockingQueue< E >::put(), and decaf::util::concurrent::LinkedBlockingQueue< E >::take().
virtual void decaf::util::concurrent::Mutex::notifyAll | ( | ) | [virtual] |
Signals the waiters on this object that it can now wake up and continue.
Must have this object locked before calling.
IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. |
RuntimeException | if an error occurs while notifying the waiting threads. |
Implements decaf::util::concurrent::Synchronizable.
Referenced by decaf::util::StlQueue< T >::notifyAll(), decaf::util::StlMap< std::string, cms::Topic * >::notifyAll(), decaf::util::concurrent::CopyOnWriteArrayList< ServiceListener * >::notifyAll(), decaf::util::concurrent::ConcurrentStlMap< Pointer< ProducerId >, Pointer< ProducerState >, ProducerId::COMPARATOR >::notifyAll(), and decaf::util::AbstractCollection< cms::Connection * >::notifyAll().
std::string decaf::util::concurrent::Mutex::toString | ( | ) | const |
virtual bool decaf::util::concurrent::Mutex::tryLock | ( | ) | [virtual] |
Attempts to Lock the object, if the lock is already held by another thread than this method returns false.
RuntimeException | if an error occurs while locking the object. |
Implements decaf::util::concurrent::Synchronizable.
Referenced by decaf::util::StlQueue< T >::tryLock(), decaf::util::StlMap< std::string, cms::Topic * >::tryLock(), decaf::util::concurrent::CopyOnWriteArrayList< ServiceListener * >::tryLock(), decaf::util::concurrent::ConcurrentStlMap< Pointer< ProducerId >, Pointer< ProducerState >, ProducerId::COMPARATOR >::tryLock(), and decaf::util::AbstractCollection< cms::Connection * >::tryLock().
virtual void decaf::util::concurrent::Mutex::unlock | ( | ) | [virtual] |
Unlocks the object.
RuntimeException | if an error occurs while unlocking the object. |
Implements decaf::util::concurrent::Synchronizable.
Referenced by decaf::util::StlQueue< T >::unlock(), decaf::util::StlMap< std::string, cms::Topic * >::unlock(), decaf::util::concurrent::CopyOnWriteArrayList< ServiceListener * >::unlock(), decaf::util::concurrent::ConcurrentStlMap< Pointer< ProducerId >, Pointer< ProducerState >, ProducerId::COMPARATOR >::unlock(), and decaf::util::AbstractCollection< cms::Connection * >::unlock().
virtual void decaf::util::concurrent::Mutex::wait | ( | long long | millisecs, |
int | nanos | ||
) | [virtual] |
Waits on a signal from this object, which is generated by a call to Notify.
Must have this object locked before calling. This wait will timeout after the specified time interval. This method is similar to the one argument wait function except that it add a finer grained control over the amount of time that it waits by adding in the additional nanosecond argument.
NOTE: The ability to wait accurately at a nanosecond scale depends on the platform and OS that the Decaf API is running on, some systems do not provide an accurate enough clock to provide this level of granularity.
millisecs | the time in milliseconds to wait, or WAIT_INIFINITE |
nanos | additional time in nanoseconds with a range of 0-999999 |
IllegalArgumentException | if an error occurs or the nanos argument is not in the range of [0-999999] |
RuntimeException | if an error occurs while waiting on the object. |
InterruptedException | if the wait is interrupted before it completes. |
IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. |
Implements decaf::util::concurrent::Synchronizable.
virtual void decaf::util::concurrent::Mutex::wait | ( | long long | millisecs | ) | [virtual] |
Waits on a signal from this object, which is generated by a call to Notify.
Must have this object locked before calling. This wait will timeout after the specified time interval.
millisecs | the time in milliseconds to wait, or WAIT_INIFINITE |
RuntimeException | if an error occurs while waiting on the object. |
InterruptedException | if the wait is interrupted before it completes. |
IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. |
Implements decaf::util::concurrent::Synchronizable.
virtual void decaf::util::concurrent::Mutex::wait | ( | ) | [virtual] |
Waits on a signal from this object, which is generated by a call to Notify.
Must have this object locked before calling.
RuntimeException | if an error occurs while waiting on the object. |
InterruptedException | if the wait is interrupted before it completes. |
IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. |
Implements decaf::util::concurrent::Synchronizable.
Referenced by decaf::util::concurrent::LinkedBlockingQueue< E >::offer(), decaf::util::concurrent::LinkedBlockingQueue< E >::poll(), decaf::util::concurrent::LinkedBlockingQueue< E >::put(), decaf::util::concurrent::LinkedBlockingQueue< E >::take(), decaf::util::StlQueue< T >::wait(), decaf::util::StlMap< std::string, cms::Topic * >::wait(), decaf::util::concurrent::CopyOnWriteArrayList< ServiceListener * >::wait(), decaf::util::concurrent::ConcurrentStlMap< Pointer< ProducerId >, Pointer< ProducerState >, ProducerId::COMPARATOR >::wait(), and decaf::util::AbstractCollection< cms::Connection * >::wait().