Public Member Functions

TAO_Named_RT_Mutex_Manager Class Reference

Manages the names of named and unnamed RT Mutexes. More...

#include <RT_ORB.h>

List of all members.

Public Member Functions

 TAO_Named_RT_Mutex_Manager (void)
 Constructor.
 ~TAO_Named_RT_Mutex_Manager (void)
 Destructor.
RTCORBA::Mutex_ptr create_mutex (void)
void destroy_mutex (RTCORBA::Mutex_ptr the_mutex)
RTCORBA::Mutex_ptr create_named_mutex (const char *name, CORBA::Boolean_out created_flag)
RTCORBA::Mutex_ptr open_named_mutex (const char *name)

Detailed Description

Manages the names of named and unnamed RT Mutexes.

Definition at line 50 of file RT_ORB.h.


Constructor & Destructor Documentation

TAO_Named_RT_Mutex_Manager::TAO_Named_RT_Mutex_Manager ( void   ) 

Constructor.

Definition at line 77 of file RT_ORB.cpp.

{
}

TAO_Named_RT_Mutex_Manager::~TAO_Named_RT_Mutex_Manager ( void   ) 

Destructor.

Definition at line 81 of file RT_ORB.cpp.

{
}


Member Function Documentation

RTCORBA::Mutex_ptr TAO_Named_RT_Mutex_Manager::create_mutex ( void   ) 

Definition at line 86 of file RT_ORB.cpp.

{
  TAO_RT_Mutex *mutex = 0;
  ACE_NEW_THROW_EX (mutex,
                    TAO_RT_Mutex (),
                    CORBA::NO_MEMORY (
                      CORBA::SystemException::_tao_minor_code (
                        TAO::VMCID,
                        ENOMEM),
                      CORBA::COMPLETED_NO));

  return mutex;
}

RTCORBA::Mutex_ptr TAO_Named_RT_Mutex_Manager::create_named_mutex ( const char *  name,
CORBA::Boolean_out  created_flag 
)

Definition at line 135 of file RT_ORB.cpp.

{
#if (TAO_HAS_NAMED_RT_MUTEXES == 1)
  // The following should be atomic.
  ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
                      monitor,
                      this->lock_,
                      CORBA::INTERNAL ());

  // Optimistic that we'll find it.
  created_flag = false;

  // If we find the mutex, simply return it.
  RTCORBA::Mutex_var mutex;
  if (this->map_.find (name, mutex) != 0)
    {
      // Oops, we didn't find it.
      created_flag = true;

      RTCORBA::Mutex_ptr tmp_mutex;

      // Create a new one.
      ACE_NEW_THROW_EX (tmp_mutex,
                        TAO_Named_RT_Mutex (name),
                        CORBA::NO_MEMORY (
                          CORBA::SystemException::_tao_minor_code (
                            TAO::VMCID,
                            ENOMEM),
                          CORBA::COMPLETED_NO));

      mutex = tmp_mutex;

      // Add it to the map.
      int const result = this->map_.bind (name, mutex);

      if (result != 0)
        throw ::CORBA::INTERNAL ();
    }

  // Return the one we found or created.
  return mutex._retn ();
#else /* TAO_HAS_NAMED_RT_MUTEXES */
  ACE_UNUSED_ARG (name);
  ACE_UNUSED_ARG (created_flag);
  throw ::CORBA::NO_IMPLEMENT ();
#endif /* TAO_HAS_NAMED_RT_MUTEXES */
}

void TAO_Named_RT_Mutex_Manager::destroy_mutex ( RTCORBA::Mutex_ptr  the_mutex  ) 

Definition at line 129 of file RT_ORB.cpp.

{
}

RTCORBA::Mutex_ptr TAO_Named_RT_Mutex_Manager::open_named_mutex ( const char *  name  ) 

Definition at line 185 of file RT_ORB.cpp.

{
#if (TAO_HAS_NAMED_RT_MUTEXES == 1)
  // The following should be atomic.
  ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
                      monitor,
                      this->lock_,
                      CORBA::INTERNAL ());

  // If we find the mutex, simply return it.
  RTCORBA::Mutex_var mutex;
  if (this->map_.find (name, mutex) != 0)
    throw RTCORBA::RTORB::MutexNotFound ();

  // Return the one we found.
  return mutex._retn ();
#else /* TAO_HAS_NAMED_RT_MUTEXES */
  ACE_UNUSED_ARG (name);
  throw ::CORBA::NO_IMPLEMENT ();
#endif /* TAO_HAS_NAMED_RT_MUTEXES */
}


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines