TAO_RT_Mutex Class Reference

Abstract base class for the TAO RT Mutex implementations. More...

#include <RT_Mutex.h>

Inheritance diagram for TAO_RT_Mutex:

Inheritance graph
[legend]
Collaboration diagram for TAO_RT_Mutex:

Collaboration graph
[legend]
List of all members.

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.


Detailed Description

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 54 of file RT_Mutex.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_RT_Mutex::~TAO_RT_Mutex void   )  [protected, virtual]
 

Destructor.

Definition at line 15 of file RT_Mutex.cpp.

00016 {
00017 }


Member Function Documentation

void TAO_RT_Mutex::lock  )  throw (CORBA::SystemException) [virtual]
 

Acquire the lock.

Implements RTCORBA::Mutex.

Definition at line 20 of file RT_Mutex.cpp.

References ACE_THROW.

00022 {
00023   if (this->mu_.acquire () != 0)
00024     ACE_THROW (CORBA::INTERNAL ());
00025 }

const char * TAO_RT_Mutex::name void   )  const [virtual]
 

Returns the name of the mutex.

Definition at line 74 of file RT_Mutex.cpp.

00075 {
00076   return 0;
00077 }

CORBA::Boolean TAO_RT_Mutex::try_lock TimeBase::TimeT  max_wait  )  throw (CORBA::SystemException) [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 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 }

void TAO_RT_Mutex::unlock  )  throw (CORBA::SystemException) [virtual]
 

Release the lock.

Implements RTCORBA::Mutex.

Definition at line 28 of file RT_Mutex.cpp.

References ACE_THROW.

00030 {
00031   if (this->mu_.release () != 0)
00032     ACE_THROW (CORBA::INTERNAL ());
00033 }


Member Data Documentation

TAO_SYNCH_MUTEX TAO_RT_Mutex::mu_ [protected]
 

Synchronization lock.

Definition at line 88 of file RT_Mutex.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 12:59:31 2006 for TAO_RTCORBA by doxygen 1.3.6