haiku/headers/posix/semaphore.h
Jérôme Duval a866e2d902 POSIX: introduce sem_clockwait
will appear in the next version: https://www.opengroup.org/austin/docs/austin_1110.pdf

Change-Id: Iee3faf23647aa5244ad316fe1c3d825592483935
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4966
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-02-18 21:27:06 +00:00

47 lines
985 B
C

/*
* Copyright 2008-2015 Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _SEMAPHORE_H_
#define _SEMAPHORE_H_
#include <fcntl.h>
#include <stdint.h>
#include <sys/cdefs.h>
#include <time.h>
typedef struct _sem_t {
int32_t type;
union {
int32_t named_sem_id;
int32_t unnamed_sem;
} u;
int32_t padding[2];
} sem_t;
#define SEM_FAILED ((sem_t*)(long)-1)
__BEGIN_DECLS
sem_t* sem_open(const char* name, int openFlags,...);
int sem_close(sem_t* semaphore);
int sem_unlink(const char* name);
int sem_init(sem_t* semaphore, int shared, unsigned value);
int sem_destroy(sem_t* semaphore);
int sem_post(sem_t* semaphore);
int sem_clockwait(sem_t* semaphore, clockid_t clock_id,
const struct timespec* abstime);
int sem_timedwait(sem_t* semaphore, const struct timespec* abstime);
int sem_trywait(sem_t* semaphore);
int sem_wait(sem_t* semaphore);
int sem_getvalue(sem_t* semaphore, int* value);
__END_DECLS
#endif /* _SEMAPHORE_H_ */