Abstract base class for the TAO RT Mutex implementations. More...
#include <RT_Mutex.h>
Public Member Functions | |
virtual void | lock (void) |
Acquire the lock. | |
virtual void | unlock (void) |
Release the lock. | |
virtual CORBA::Boolean | try_lock (TimeBase::TimeT max_wait) |
virtual const char * | name (void) const |
Returns the name of the mutex. | |
virtual | ~TAO_RT_Mutex (void) |
Destructor. | |
Protected Attributes | |
TAO_SYNCH_MUTEX | mu_ |
Synchronization lock. |
Abstract base class for the TAO RT Mutex implementations.
This class just serves as a base class for any of the TAO RT Mutex implementations. Instances of these classes should be created using the RTCORBA::create_mutex() method.
Definition at line 51 of file RT_Mutex.h.
TAO_RT_Mutex::~TAO_RT_Mutex | ( | void | ) | [virtual] |
void TAO_RT_Mutex::lock | ( | void | ) | [virtual] |
Acquire the lock.
Definition at line 21 of file RT_Mutex.cpp.
{ if (this->mu_.acquire () != 0) throw ::CORBA::INTERNAL (); }
const char * TAO_RT_Mutex::name | ( | void | ) | const [virtual] |
CORBA::Boolean TAO_RT_Mutex::try_lock | ( | TimeBase::TimeT | max_wait | ) | [virtual] |
Acquire the lock, but only wait up to max_wait time. Note that this operation may not be available on all OS platforms, so if you're interested in writing maximally portable programs avoid using this operation in your program designs.
Definition at line 35 of file RT_Mutex.cpp.
{ int result; if (wait_time == 0) // No wait. result = this->mu_.tryacquire (); else { // Wait for the specified amount of time before giving up. // (wait_time units are 100ns. See TimeBase.pidl) TimeBase::TimeT seconds = wait_time / 10000000u; TimeBase::TimeT microseconds = (wait_time % 10000000u) / 10; ACE_Time_Value relative_time (ACE_U64_TO_U32 (seconds), ACE_U64_TO_U32 (microseconds)); ACE_Time_Value absolute_time = relative_time + ACE_OS::gettimeofday (); result = this->mu_.acquire (absolute_time); } if (result == 0) return 1; else if (result == -1 && (errno == ETIME || errno == EBUSY)) return 0; else // Some really bad error. throw ::CORBA::INTERNAL (); }
void TAO_RT_Mutex::unlock | ( | void | ) | [virtual] |
Release the lock.
Definition at line 28 of file RT_Mutex.cpp.
{ if (this->mu_.release () != 0) throw ::CORBA::INTERNAL (); }
TAO_SYNCH_MUTEX TAO_RT_Mutex::mu_ [protected] |
Synchronization lock.
Definition at line 80 of file RT_Mutex.h.