Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Process_Semaphore.cpp

Go to the documentation of this file.
00001 #include "ace_pch.h"
00002 // $Id: Process_Semaphore.cpp,v 1.1.1.1.40.1 2003/03/13 19:44:22 chad Exp $
00003 
00004 #include "ace/Process_Semaphore.h"
00005 #include "ace/Log_Msg.h"
00006 
00007 #if !defined (__ACE_INLINE__)
00008 #include "ace/Process_Semaphore.inl"
00009 #endif /* __ACE_INLINE__ */
00010 
00011 ACE_RCSID(ace, Process_Semaphore, "$Id: Process_Semaphore.cpp,v 1.1.1.1.40.1 2003/03/13 19:44:22 chad Exp $")
00012 
00013 void
00014 ACE_Process_Semaphore::dump (void) const
00015 {
00016 // ACE_TRACE ("ACE_Process_Semaphore::dump");
00017   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00018   this->lock_.dump ();
00019   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00020 }
00021 
00022 ACE_Process_Semaphore::ACE_Process_Semaphore (u_int count,
00023                                               const ACE_TCHAR *name,
00024                                               void *arg,
00025                                               int max)
00026 #if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS)
00027   : lock_ (count, USYNC_PROCESS, name, arg, max)
00028 #else
00029   : lock_ (name, ACE_SV_Semaphore_Complex::ACE_CREATE, count)
00030 #endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */
00031 {
00032   arg = arg;
00033   max = max;
00034 // ACE_TRACE ("ACE_Process_Semaphore::ACE_Process_Semaphore");
00035 }
00036 
00037 ACE_Process_Semaphore::~ACE_Process_Semaphore (void)
00038 {
00039   // ACE_TRACE ("ACE_Process_Semaphore::~ACE_Process_Semaphore");
00040 }
00041 
00042 // Explicitly destroy the semaphore.
00043 
00044 int
00045 ACE_Process_Semaphore::remove (void)
00046 {
00047 // ACE_TRACE ("ACE_Process_Semaphore::remove");
00048   return this->lock_.remove ();
00049 }
00050 
00051 // Block the thread until the semaphore count becomes
00052 // greater than 0, then decrement it.
00053 
00054 int
00055 ACE_Process_Semaphore::acquire (void)
00056 {
00057 // ACE_TRACE ("ACE_Process_Semaphore::acquire");
00058   return this->lock_.acquire ();
00059 }
00060 
00061 // Conditionally decrement the semaphore if count is greater
00062 // than 0 (i.e., won't block).
00063 
00064 int
00065 ACE_Process_Semaphore::tryacquire (void)
00066 {
00067 // ACE_TRACE ("ACE_Process_Semaphore::tryacquire");
00068   return this->lock_.tryacquire ();
00069 }
00070 
00071 // Increment the semaphore, potentially unblocking
00072 // a waiting thread.
00073 
00074 int
00075 ACE_Process_Semaphore::release (void)
00076 {
00077 // ACE_TRACE ("ACE_Process_Semaphore::release");
00078   return this->lock_.release ();
00079 }
00080 
00081 //
00082 // These are instantiated both with and without ACE_HAS_THREADS.
00083 //
00084 #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
00085 
00086 // template class ACE_Guard<ACE_Process_Semaphore>;
00087 
00088 #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
00089 
00090 // #pragma instantiate ACE_Guard<ACE_Process_Semaphore>
00091 
00092 #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */

Generated on Mon Jun 16 11:20:56 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002