8 #define RZ_SEM_NAMED_ONLY 1
9 #define RZ_SEM_NAME_LEN_MAX 31
11 #define RZ_SEM_NAMED_ONLY 0
15 #include <uuid/uuid.h>
37 uuid_unparse(uuid,
name + 1);
38 if (strlen(
name) > RZ_SEM_NAME_LEN_MAX - 1) {
39 name[RZ_SEM_NAME_LEN_MAX - 1] =
'\0';
42 if (sem->
sem == SEM_FAILED) {
87 CloseHandle(sem->sem);
102 ReleaseSemaphore(sem->sem, 1,
NULL);
116 WaitForSingleObject(sem->sem, INFINITE);
RZ_API void Ht_() free(HtName_(Ht) *ht)
void * malloc(size_t size)
int sem_wait(UV_PLATFORM_SEM_T *semid)
int sem_destroy(UV_PLATFORM_SEM_T *semid)
int sem_post(UV_PLATFORM_SEM_T *semid)
int sem_init(UV_PLATFORM_SEM_T *semid, int pshared, unsigned int value)
#define rz_return_if_fail(expr)
RZ_API RZ_OWN RzThreadSemaphore * rz_th_sem_new(unsigned int initial)
Allocates and initialize a RzThreadSemaphore structure.
RZ_API void rz_th_sem_free(RZ_NULLABLE RzThreadSemaphore *sem)
Frees a RzThreadSemaphore struct.
RZ_API void rz_th_sem_post(RZ_NONNULL RzThreadSemaphore *sem)
increments (releases) a semaphore
RZ_API void rz_th_sem_wait(RZ_NONNULL RzThreadSemaphore *sem)
Decrements (acquires) the semaphore (waits indefinetely)