ACE 8.0.5
Loading...
Searching...
No Matches
ACE_SV_Semaphore_Simple Class Reference

This is a simple semaphore package that assumes there are no race conditions for initialization (i.e., the order of process startup must be well defined). More...

#include <SV_Semaphore_Simple.h>

Inheritance diagram for ACE_SV_Semaphore_Simple:

Public Types

enum  { ACE_CREATE = IPC_CREAT , ACE_EXCL = IPC_EXCL , ACE_OPEN = 0 }

Public Member Functions

 ACE_SV_Semaphore_Simple ()
 ACE_SV_Semaphore_Simple (key_t key, short flags=ACE_SV_Semaphore_Simple::ACE_CREATE, int initial_value=1, u_short nsems=1, mode_t perms=ACE_DEFAULT_FILE_PERMS)
 ACE_SV_Semaphore_Simple (const char *name, short flags=ACE_SV_Semaphore_Simple::ACE_CREATE, int initial_value=1, u_short nsems=1, mode_t perms=ACE_DEFAULT_FILE_PERMS)
 ACE_SV_Semaphore_Simple (const wchar_t *name, short flags=ACE_SV_Semaphore_Simple::ACE_CREATE, int initial_value=1, u_short nsems=1, mode_t perms=ACE_DEFAULT_FILE_PERMS)
 ~ACE_SV_Semaphore_Simple ()
int open (const char *name, short flags=ACE_SV_Semaphore_Simple::ACE_CREATE, int initial_value=1, u_short nsems=1, mode_t perms=ACE_DEFAULT_FILE_PERMS)
int open (const wchar_t *name, short flags=ACE_SV_Semaphore_Simple::ACE_CREATE, int initial_value=1, u_short nsems=1, mode_t perms=ACE_DEFAULT_FILE_PERMS)
int open (key_t key, short flags=ACE_SV_Semaphore_Simple::ACE_CREATE, int initial_value=1, u_short nsems=1, mode_t perms=ACE_DEFAULT_FILE_PERMS)
int close ()
int remove () const
int acquire (u_short n=0, short flags=0) const
int acquire_read (u_short n=0, short flags=0) const
 Acquire a semaphore for reading.
int acquire_write (u_short n=0, short flags=0) const
 Acquire a semaphore for writing.
int tryacquire (u_short n=0, short flags=0) const
 Non-blocking version of <acquire>.
int tryacquire_read (u_short n=0, short flags=0) const
 Try to acquire the semaphore for reading.
int tryacquire_write (u_short n=0, short flags=0) const
 Try to acquire the semaphore for writing.
int release (u_short n=0, short flags=0) const

Detailed Description

This is a simple semaphore package that assumes there are no race conditions for initialization (i.e., the order of process startup must be well defined).

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
ACE_CREATE 
ACE_EXCL 
ACE_OPEN 

Constructor & Destructor Documentation

◆ ACE_SV_Semaphore_Simple() [1/4]

ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple ( )

◆ ACE_SV_Semaphore_Simple() [2/4]

ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple ( key_t key,
short flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
int initial_value = 1,
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS )

◆ ACE_SV_Semaphore_Simple() [3/4]

ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple ( const char * name,
short flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
int initial_value = 1,
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS )

◆ ACE_SV_Semaphore_Simple() [4/4]

ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple ( const wchar_t * name,
short flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
int initial_value = 1,
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS )

◆ ~ACE_SV_Semaphore_Simple()

ACE_SV_Semaphore_Simple::~ACE_SV_Semaphore_Simple ( )

Member Function Documentation

◆ acquire()

int ACE_SV_Semaphore_Simple::acquire ( u_short n = 0,
short flags = 0 ) const
inline

Wait until a ACE_SV_Semaphore's value is greater than 0, the decrement it by 1 and return. Dijkstra's P operation, Tannenbaums DOWN operation.

◆ acquire_read()

int ACE_SV_Semaphore_Simple::acquire_read ( u_short n = 0,
short flags = 0 ) const
inline

Acquire a semaphore for reading.

◆ acquire_write()

int ACE_SV_Semaphore_Simple::acquire_write ( u_short n = 0,
short flags = 0 ) const
inline

Acquire a semaphore for writing.

◆ close()

int ACE_SV_Semaphore_Simple::close ( )
inline

Close a ACE_SV_Semaphore, marking it as invalid for subsequent operations...

◆ open() [1/3]

int ACE_SV_Semaphore_Simple::open ( const char * name,
short flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
int initial_value = 1,
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS )

◆ open() [2/3]

int ACE_SV_Semaphore_Simple::open ( const wchar_t * name,
short flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
int initial_value = 1,
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS )
inline

◆ open() [3/3]

int ACE_SV_Semaphore_Simple::open ( key_t key,
short flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
int initial_value = 1,
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS )

Open or create one or more SV_Semaphores. We return 0 if all is OK, else -1.

◆ release()

int ACE_SV_Semaphore_Simple::release ( u_short n = 0,
short flags = 0 ) const
inline

Increment ACE_SV_Semaphore by one. Dijkstra's V operation, Tannenbaums UP operation.

◆ remove()

int ACE_SV_Semaphore_Simple::remove ( ) const

Remove all SV_Semaphores associated with a particular key. This call is intended to be called from a server, for example, when it is being shut down, as we do an IPC_RMID on the ACE_SV_Semaphore, regardless of whether other processes may be using it or not. Most other processes should use close() below.

◆ tryacquire()

int ACE_SV_Semaphore_Simple::tryacquire ( u_short n = 0,
short flags = 0 ) const
inline

Non-blocking version of <acquire>.

◆ tryacquire_read()

int ACE_SV_Semaphore_Simple::tryacquire_read ( u_short n = 0,
short flags = 0 ) const
inline

Try to acquire the semaphore for reading.

◆ tryacquire_write()

int ACE_SV_Semaphore_Simple::tryacquire_write ( u_short n = 0,
short flags = 0 ) const
inline

Try to acquire the semaphore for writing.


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