#include <RT_Mutex.h>
Inheritance diagram for TAO_RT_Mutex:
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. | |
Protected Member Functions | |
virtual | ~TAO_RT_Mutex (void) |
Destructor. | |
Protected Attributes | |
TAO_SYNCH_MUTEX | mu_ |
Synchronization lock. |
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_BEGIN_VERSIONED_NAMESPACE_DECL TAO_RT_Mutex::~TAO_RT_Mutex | ( | void | ) | [protected, virtual] |
void TAO_RT_Mutex::lock | ( | void | ) | [virtual] |
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.
References EBUSY, ACE_OS::gettimeofday(), and mu_.
00036 { 00037 int result; 00038 00039 if (wait_time == 0) 00040 // No wait. 00041 result = this->mu_.tryacquire (); 00042 else 00043 { 00044 // Wait for the specified amount of time before giving up. 00045 // (wait_time units are 100ns. See TimeBase.pidl) 00046 TimeBase::TimeT seconds = wait_time / 10000000u; 00047 TimeBase::TimeT microseconds = (wait_time % 10000000u) / 10; 00048 00049 ACE_Time_Value relative_time (ACE_U64_TO_U32 (seconds), 00050 ACE_U64_TO_U32 (microseconds)); 00051 00052 ACE_Time_Value absolute_time = 00053 relative_time + 00054 ACE_OS::gettimeofday (); 00055 00056 result = this->mu_.acquire (absolute_time); 00057 } 00058 00059 if (result == 0) 00060 return 1; 00061 else if (result == -1 && 00062 (errno == ETIME || 00063 errno == EBUSY)) 00064 return 0; 00065 else 00066 // Some really bad error. 00067 throw ::CORBA::INTERNAL (); 00068 }
void TAO_RT_Mutex::unlock | ( | void | ) | [virtual] |
TAO_SYNCH_MUTEX TAO_RT_Mutex::mu_ [protected] |