Go to the documentation of this file.00001
00002
00003 #include "ace/Semaphore.h"
00004
00005 #if !defined (__ACE_INLINE__)
00006 #include "ace/Semaphore.inl"
00007 #endif
00008
00009 #include "ace/Log_Msg.h"
00010 #include "ace/ACE.h"
00011
00012 ACE_RCSID (ace,
00013 Semaphore,
00014 "$Id: Semaphore.cpp 84282 2009-01-30 15:04:29Z msmit $")
00015
00016 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00017
00018 ACE_ALLOC_HOOK_DEFINE(ACE_Semaphore)
00019
00020 void
00021 ACE_Semaphore::dump (void) const
00022 {
00023 #if defined (ACE_HAS_DUMP)
00024
00025
00026 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00027 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
00028 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00029 #endif
00030 }
00031
00032 ACE_Semaphore::ACE_Semaphore (unsigned int count,
00033 int type,
00034 const ACE_TCHAR *name,
00035 void *arg,
00036 int max)
00037 : removed_ (false)
00038 {
00039
00040 #if defined(ACE_LACKS_UNNAMED_SEMAPHORE)
00041
00042 ACE_TCHAR iname[ACE_UNIQUE_NAME_LEN];
00043 if (name == 0)
00044 ACE::unique_name (this, iname, ACE_UNIQUE_NAME_LEN);
00045 if (ACE_OS::sema_init (&this->semaphore_, count, type,
00046 name ? name : iname,
00047 arg, max) != 0)
00048 #else
00049 if (ACE_OS::sema_init (&this->semaphore_, count, type,
00050 name, arg, max) != 0)
00051 #endif
00052 ACE_ERROR ((LM_ERROR,
00053 ACE_TEXT ("%p\n"),
00054 ACE_TEXT ("ACE_Semaphore::ACE_Semaphore")));
00055 }
00056
00057 ACE_Semaphore::~ACE_Semaphore (void)
00058 {
00059
00060
00061 this->remove ();
00062 }
00063
00064 ACE_END_VERSIONED_NAMESPACE_DECL