ACE_Process_Semaphore Class Reference

Wrapper for Dijkstra style general semaphores that work across processes. More...

#include <Process_Semaphore.h>

Collaboration diagram for ACE_Process_Semaphore:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ACE_Process_Semaphore (u_int count=1, const ACE_TCHAR *name=0, void *=0, int max=0x7FFFFFFF)
int remove (void)
int acquire (void)
int tryacquire (void)
int release (void)
 Increment the semaphore, potentially unblocking a waiting thread.
int acquire_read (void)
int acquire_write (void)
int tryacquire_read (void)
int tryacquire_write (void)
int tryacquire_write_upgrade (void)
const ACE_sema_t & lock (void) const
 Return the underlying lock.
void dump (void) const
 Dump the state of an object.

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

Protected Attributes

ACE_Semaphore lock_


Detailed Description

Wrapper for Dijkstra style general semaphores that work across processes.

Constructor & Destructor Documentation

ACE_Process_Semaphore::ACE_Process_Semaphore ( u_int  count = 1,
const ACE_TCHAR name = 0,
void *  arg = 0,
int  max = 0x7FFFFFFF 
)

Initialize the semaphore, with an initial value of count and a maximum value of max.


Member Function Documentation

int ACE_Process_Semaphore::remove ( void   ) 

Explicitly destroy the semaphore. Note that only one thread should call this method since it doesn't protect against race conditions.

int ACE_Process_Semaphore::acquire ( void   ) 

Block the thread until the semaphore count becomes greater than 0, then decrement it.

int ACE_Process_Semaphore::tryacquire ( void   ) 

Conditionally decrement the semaphore if count is greater than 0 (i.e., won't block). Returns -1 on failure. If we "failed" because someone else already had the lock, errno is set to EBUSY.

int ACE_Process_Semaphore::release ( void   ) 

Increment the semaphore, potentially unblocking a waiting thread.

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_Process_Semaphore::acquire_read ( void   ) 

Acquire semaphore ownership. This calls <acquire> and is only here to make the ACE_Process_Semaphore interface consistent with the other synchronization APIs.

ACE_INLINE int ACE_Process_Semaphore::acquire_write ( void   ) 

Acquire semaphore ownership. This calls <acquire> and is only here to make the ACE_Process_Semaphore interface consistent with the other synchronization APIs.

ACE_INLINE int ACE_Process_Semaphore::tryacquire_read ( void   ) 

Conditionally acquire semaphore (i.e., won't block). This calls <tryacquire> and is only here to make the ACE_Process_Semaphore interface consistent with the other synchronization APIs. Returns -1 on failure. If we "failed" because someone else already had the lock, errno is set to EBUSY.

ACE_INLINE int ACE_Process_Semaphore::tryacquire_write ( void   ) 

Conditionally acquire semaphore (i.e., won't block). This calls <tryacquire> and is only here to make the ACE_Process_Semaphore interface consistent with the other synchronization APIs. Returns -1 on failure. If we "failed" because someone else already had the lock, errno is set to EBUSY.

ACE_INLINE int ACE_Process_Semaphore::tryacquire_write_upgrade ( void   ) 

This is only here to make the ACE_Process_Semaphore interface consistent with the other synchronization APIs. Assumes the caller has already acquired the semaphore using one of the above calls, and returns 0 (success) always.

const ACE_sema_t& ACE_Process_Semaphore::lock ( void   )  const

Return the underlying lock.

ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_Process_Semaphore::dump ( void   )  const

Dump the state of an object.


Member Data Documentation

Declare the dynamic allocation hooks.


The documentation for this class was generated from the following files:

Generated on Wed Apr 23 02:40:43 2008 for ACE by  doxygen 1.5.5