Semaphore.cpp

Go to the documentation of this file.
00001 // $Id: Semaphore.cpp 80826 2008-03-04 14:51:23Z wotte $
00002 
00003 #include "ace/Semaphore.h"
00004 
00005 #if !defined (__ACE_INLINE__)
00006 #include "ace/Semaphore.inl"
00007 #endif /* __ACE_INLINE__ */
00008 
00009 #include "ace/Log_Msg.h"
00010 #include "ace/ACE.h"
00011 
00012 ACE_RCSID (ace,
00013            Semaphore,
00014            "$Id: Semaphore.cpp 80826 2008-03-04 14:51:23Z wotte $")
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 // ACE_TRACE ("ACE_Semaphore::dump");
00024 
00025   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00026   ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
00027   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00028 }
00029 
00030 ACE_Semaphore::ACE_Semaphore (unsigned int count,
00031                               int type,
00032                               const ACE_TCHAR *name,
00033                               void *arg,
00034                               int max)
00035   : removed_ (false)
00036 {
00037 // ACE_TRACE ("ACE_Semaphore::ACE_Semaphore");
00038 #if defined(ACE_LACKS_UNNAMED_SEMAPHORE)
00039 // if the user does not provide a name, we generate a unique name here
00040   ACE_TCHAR iname[ACE_UNIQUE_NAME_LEN];
00041   if (name == 0)
00042     ACE::unique_name (this, iname, ACE_UNIQUE_NAME_LEN);
00043   if (ACE_OS::sema_init (&this->semaphore_, count, type,
00044                          name ? name : iname,
00045                          arg, max) != 0)
00046 #else
00047   if (ACE_OS::sema_init (&this->semaphore_, count, type,
00048                          name, arg, max) != 0)
00049 #endif
00050     ACE_ERROR ((LM_ERROR,
00051                 ACE_TEXT ("%p\n"),
00052                 ACE_TEXT ("ACE_Semaphore::ACE_Semaphore")));
00053 }
00054 
00055 ACE_Semaphore::~ACE_Semaphore (void)
00056 {
00057 // ACE_TRACE ("ACE_Semaphore::~ACE_Semaphore");
00058 
00059   this->remove ();
00060 }
00061 
00062 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:18:42 2010 for ACE by  doxygen 1.4.7