ACE 8.0.1
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
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]

Public Member Functions

 ACE_Process_Semaphore (u_int count=1, const ACE_TCHAR *name=0, void *=0, int max=0x7FFFFFFF)
 
int remove ()
 
int acquire ()
 
int tryacquire ()
 
int release ()
 Increment the semaphore, potentially unblocking a waiting thread.
 
int acquire_read ()
 
int acquire_write ()
 
int tryacquire_read ()
 
int tryacquire_write ()
 
int tryacquire_write_upgrade ()
 
const ACE_sema_tlock () const
 Return the underlying lock.
 
void dump () 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::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

◆ acquire()

int ACE_Process_Semaphore::acquire ( )

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

◆ acquire_read()

int ACE_Process_Semaphore::acquire_read ( )
inline

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

◆ acquire_write()

int ACE_Process_Semaphore::acquire_write ( )
inline

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

◆ dump()

void ACE_Process_Semaphore::dump ( ) const

Dump the state of an object.

◆ lock()

const ACE_sema_t & ACE_Process_Semaphore::lock ( ) const
inline

Return the underlying lock.

◆ release()

int ACE_Process_Semaphore::release ( )

Increment the semaphore, potentially unblocking a waiting thread.

◆ remove()

int ACE_Process_Semaphore::remove ( )

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

◆ tryacquire()

int ACE_Process_Semaphore::tryacquire ( )

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.

◆ tryacquire_read()

int ACE_Process_Semaphore::tryacquire_read ( )
inline

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.

◆ tryacquire_write()

int ACE_Process_Semaphore::tryacquire_write ( )
inline

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.

◆ tryacquire_write_upgrade()

int ACE_Process_Semaphore::tryacquire_write_upgrade ( )
inline

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.

Member Data Documentation

◆ ACE_ALLOC_HOOK_DECLARE

ACE_Process_Semaphore::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

◆ lock_

ACE_Semaphore ACE_Process_Semaphore::lock_
protected

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