|
ACE 8.0.5
|
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>

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 |
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).
| ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple | ( | ) |
| 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::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::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 | ( | ) |
|
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.
|
inline |
Acquire a semaphore for reading.
|
inline |
Acquire a semaphore for writing.
|
inline |
Close a ACE_SV_Semaphore, marking it as invalid for subsequent operations...
| 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 ) |
|
inline |
| 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.
|
inline |
Increment ACE_SV_Semaphore by one. Dijkstra's V operation, Tannenbaums UP operation.
| 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.
|
inline |
Non-blocking version of <acquire>.
|
inline |
Try to acquire the semaphore for reading.
|
inline |
Try to acquire the semaphore for writing.