00001
00002
00003 #include "ace/Process_Mutex.h"
00004 #include "ace/Log_Msg.h"
00005 #include "ace/ACE.h"
00006 #include "ace/Guard_T.h"
00007 #include "ace/Process_Mutex.h"
00008 #include "ace/Malloc_T.h"
00009
00010 #if !defined (__ACE_INLINE__)
00011 #include "ace/Process_Mutex.inl"
00012 #endif
00013
00014 ACE_RCSID(ace, Process_Mutex, "$Id: Process_Mutex.cpp 79636 2007-09-13 15:18:33Z sowayaa $")
00015
00016 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00017
00018 ACE_ALLOC_HOOK_DEFINE(ACE_Process_Mutex)
00019
00020 void
00021 ACE_Process_Mutex::dump (void) const
00022 {
00023 #if defined (ACE_HAS_DUMP)
00024
00025 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00026 this->lock_.dump ();
00027 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00028 #endif
00029 }
00030
00031 const ACE_TCHAR *
00032 ACE_Process_Mutex::unique_name (void)
00033 {
00034
00035
00036
00037 ACE::unique_name (this, this->name_, ACE_UNIQUE_NAME_LEN);
00038 return this->name_;
00039 }
00040
00041 ACE_Process_Mutex::ACE_Process_Mutex (const char *name, void *arg, mode_t mode)
00042 #if defined (_ACE_USE_SV_SEM)
00043 : lock_ (name ? name : ACE_TEXT_ALWAYS_CHAR (this->unique_name ()),
00044 ACE_SV_Semaphore_Complex::ACE_CREATE,
00045 1,
00046 1,
00047 mode)
00048 #else
00049 : lock_ (USYNC_PROCESS,
00050 name ?
00051 ACE_TEXT_CHAR_TO_TCHAR (name) : this->unique_name (),
00052 (ACE_mutexattr_t *) arg,
00053 mode)
00054 #endif
00055 {
00056 #if defined (_ACE_USE_SV_SEM)
00057 ACE_UNUSED_ARG (arg);
00058 #endif
00059 }
00060
00061 #if defined (ACE_HAS_WCHAR)
00062 ACE_Process_Mutex::ACE_Process_Mutex (const wchar_t *name,
00063 void *arg,
00064 mode_t mode)
00065 #if defined (_ACE_USE_SV_SEM)
00066 : lock_ (name ?
00067 ACE_Wide_To_Ascii (name).char_rep () :
00068 ACE_TEXT_ALWAYS_CHAR (this->unique_name ()),
00069 ACE_SV_Semaphore_Complex::ACE_CREATE,
00070 1,
00071 1,
00072 mode)
00073 #else
00074 : lock_ (USYNC_PROCESS,
00075 name ?
00076 ACE_TEXT_WCHAR_TO_TCHAR (name) : this->unique_name (),
00077 (ACE_mutexattr_t *) arg,
00078 mode)
00079 #endif
00080 {
00081 #if defined (_ACE_USE_SV_SEM)
00082 ACE_UNUSED_ARG (arg);
00083 #endif
00084 }
00085 #endif
00086 ACE_Process_Mutex::~ACE_Process_Mutex (void)
00087 {
00088 }
00089
00090 ACE_END_VERSIONED_NAMESPACE_DECL