NAME

ACE_SV_Semaphore_Simple - 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).

SYNOPSIS


#include <ace/SV_Semaphore_Simple.h>


class ACE_SV_Semaphore_Simple
{
  public:
    enum { ACE_CREATE = IPC_CREAT, ACE_OPEN = 0 };
    ACE_SV_Semaphore_Simple (void);
    ACE_SV_Semaphore_Simple (
        key_t key,
        int flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
        int initial_value = 1,
        int nsems = 1,
        int perms = ACE_DEFAULT_PERMS
        );
    ACE_SV_Semaphore_Simple (
        const char *name,
        int flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
        int initial_value = 1,
        int nsems = 1,
        int perms = ACE_DEFAULT_PERMS
        );
    ~ACE_SV_Semaphore_Simple (void);
    int open (
        const char *name,
        int flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
        int initial_value = 1,
        int nsems = 1,
        int perms = ACE_DEFAULT_PERMS
        );
    int open (
        key_t key,
        int flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
        int initial_value = 1,
        int nsems = 1,
        int perms = ACE_DEFAULT_PERMS
        );
    int close (void);
    int remove (void) const;
    int acquire (int n = 0, int flags = 0) const;
    int acquire_read (int n = 0, int flags = 0) const;
    int acquire_write (int n = 0, int flags = 0) const;
    int tryacquire (int n = 0, int flags = 0) const;
    int tryacquire_read (int n = 0, int flags = 0) const;
    int tryacquire_write (int n = 0, int flags = 0) const;
    int release (int n = 0, int flags = 0) const;
    int op (int val, int semnum = 0, int flags = 0) const;
    int op (sembuf op_vec[], int nsems) const;
    int control (int cmd, semun arg, int semnum = 0) const;
    int control (int cmd, int value = 0, int semnum = 0) const;
    int get_id (void) const;
    void dump (void) const;
    ACE_ALLOC_HOOK_DECLARE;
  protected:
    key_t key_;
    int internal_id_;
    int sem_number_;
    int init (key_t k = ACE_INVALID_SEM_KEY, int i = -1);
    key_t name_2_key (const char *name);
};

Initialization and termination methods.

ACE_SV_Semaphore_Simple (void);
ACE_SV_Semaphore_Simple (
    key_t key,
    int flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
    int initial_value = 1,
    int nsems = 1,
    int perms = ACE_DEFAULT_PERMS
    );
ACE_SV_Semaphore_Simple (
    const char *name,
    int flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
    int initial_value = 1,
    int nsems = 1,
    int perms = ACE_DEFAULT_PERMS
    );
~ACE_SV_Semaphore_Simple (void);
int open (
    const char *name,
    int flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
    int initial_value = 1,
    int nsems = 1,
    int perms = ACE_DEFAULT_PERMS
    );
int open (
    key_t key,
    int flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
    int initial_value = 1,
    int nsems = 1,
    int perms = ACE_DEFAULT_PERMS
    );
int close (void);
int remove (void) const;

Semaphore acquire and release methods.

int acquire (int n = 0, int flags = 0) const;
int acquire_read (int n = 0, int flags = 0) const;
int acquire_write (int n = 0, int flags = 0) const;
int tryacquire (int n = 0, int flags = 0) const;
int tryacquire_read (int n = 0, int flags = 0) const;
int tryacquire_write (int n = 0, int flags = 0) const;
int release (int n = 0, int flags = 0) const;

Semaphore operation methods.

int op (int val, int semnum = 0, int flags = 0) const;
int op (sembuf op_vec[], int nsems) const;

Semaphore control methods.

int control (int cmd, semun arg, int semnum = 0) const;
int control (int cmd, int value = 0, int semnum = 0) const;
int get_id (void) const;
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;

AUTHOR

Doug Schmidt

LIBRARY

ace