#ifndef _SVSEM_UTIL_H
|
#define _SVSEM_UTIL_H
|
|
#include "usg_common.h"
|
|
class SvsemUtil {
|
public:
|
static int get(key_t key, int nsems, unsigned short * arr_val) ;
|
/* Reserve semaphore (blocking), return 0 on success, or -1 with 'errno'
|
set to EINTR if operation was interrupted by a signal handler */
|
|
/* Reserve semaphore - decrement it by 1 */
|
static int dec(int semId) ;
|
|
static int dec_nowait(int semId) ;
|
|
static int dec_timeout(const int semId, const struct timespec *timeout) ;
|
|
|
/**
|
* If sem_op equals 0, the value of the semaphore is checked to see whether it
|
* currently equals 0. If it does, the operation completes immediately; otherwise,
|
* semop() blocks until the semaphore value becomes 0.
|
*/
|
static int zero(int semId) ;
|
|
|
static int zero_nowait(int semId) ;
|
|
static int zero_timeout(const int semId, const struct timespec *timeout) ;
|
|
|
/* Release semaphore - increment it by 1 */
|
static int inc(int semId) ;
|
|
|
static int set(int semId, int val) ;
|
|
|
|
|
static int cond_wait(int semid ) ;
|
static int cond_signal(int semid ) ;
|
static void remove(int semid) ;
|
};
|
|
#endif
|