#include <RT_Mutex.h>
Inheritance diagram for TAO_RT_Mutex:
Public Member Functions | |
virtual void | lock () throw (CORBA::SystemException) |
Acquire the lock. | |
virtual void | unlock () throw (CORBA::SystemException) |
Release the lock. | |
virtual CORBA::Boolean | try_lock (TimeBase::TimeT max_wait) throw (CORBA::SystemException) |
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 54 of file RT_Mutex.h.
|
Destructor.
Definition at line 15 of file RT_Mutex.cpp.
00016 { 00017 } |
|
Acquire the lock.
Implements RTCORBA::Mutex. Definition at line 20 of file RT_Mutex.cpp. References ACE_THROW.
|
|
Returns the name of the mutex.
Definition at line 74 of file RT_Mutex.cpp.
00075 {
00076 return 0;
00077 }
|
|
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 36 of file RT_Mutex.cpp. References ACE_THROW_RETURN, ACE_U64_TO_U32, EBUSY, ETIME, and ACE_OS::gettimeofday().
00039 { 00040 int result; 00041 00042 if (wait_time == 0) 00043 // No wait. 00044 result = this->mu_.tryacquire (); 00045 else 00046 { 00047 // Wait for the specified amount of time before giving up. 00048 // (wait_time units are 100ns. See TimeBase.pidl) 00049 TimeBase::TimeT seconds = wait_time / 10000000u; 00050 TimeBase::TimeT microseconds = (wait_time % 10000000u) / 10; 00051 00052 ACE_Time_Value relative_time (ACE_U64_TO_U32 (seconds), 00053 ACE_U64_TO_U32 (microseconds)); 00054 00055 ACE_Time_Value absolute_time = 00056 relative_time + 00057 ACE_OS::gettimeofday (); 00058 00059 result = this->mu_.acquire (absolute_time); 00060 } 00061 00062 if (result == 0) 00063 return 1; 00064 else if (result == -1 && 00065 (errno == ETIME || 00066 errno == EBUSY)) 00067 return 0; 00068 else 00069 // Some really bad error. 00070 ACE_THROW_RETURN (CORBA::INTERNAL (), 0); 00071 } |
|
Release the lock.
Implements RTCORBA::Mutex. Definition at line 28 of file RT_Mutex.cpp. References ACE_THROW.
|
|
Synchronization lock.
Definition at line 88 of file RT_Mutex.h. |