24 #ifndef __UTILS_IPC_SEMSET_H_ 25 #define __UTILS_IPC_SEMSET_H_ 30 class SemaphoreSetData;
51 void lock(
unsigned short sem_num = 0,
short num = 1);
52 bool try_lock(
unsigned short sem_num = 0,
short num = 1);
53 void unlock(
unsigned short sem_num = 0,
short num = -1);
66 SemaphoreSetData *data;
bool valid()
Check if the semaphore set is valid.
Fawkes library namespace.
static int free_key()
Get a non-zero free key Scans the key space sequentially until a non-zero unused key is found...
static void destroy(int key)
Destroy a semaphore set.
void lock(unsigned short sem_num=0, short num=1)
Lock resources on the semaphore set.
~SemaphoreSet()
Destructor.
void set_destroy_on_delete(bool destroy)
Set if semaphore set should be destroyed on delete.
int key()
Get key of semaphore.
void unlock(unsigned short sem_num=0, short num=-1)
Unlock resources on the semaphore set.
SemaphoreSet(const char *path, char id, int num_sems, bool create=false, bool destroy_on_delete=false)
Constructor.
void set_value(int sem_num, int val)
Set the semaphore value.
bool destroy_on_delete
Destroy this semaphore on delete?
bool try_lock(unsigned short sem_num=0, short num=1)
Try to lock resources on the semaphore set.
int get_value(int sem_num)
Get the semaphore value.