BTRFS: Reimplement TreeIterator, add some error checks and remove redundancies.
[haiku.git] / headers / posix / semaphore.h
blob0501830ac49d08c44c8f79efbc446fd890533417
1 /*
2 * Copyright 2008-2015 Haiku, Inc.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _SEMAPHORE_H_
6 #define _SEMAPHORE_H_
9 #include <fcntl.h>
10 #include <stdint.h>
11 #include <sys/cdefs.h>
12 #include <time.h>
15 typedef struct _sem_t {
16 int32_t type;
17 union {
18 int32_t named_sem_id;
19 int32_t unnamed_sem;
20 } u;
21 int32_t padding[2];
22 } sem_t;
24 #define SEM_FAILED ((sem_t*)(long)-1)
26 __BEGIN_DECLS
28 sem_t* sem_open(const char* name, int openFlags,...);
29 int sem_close(sem_t* semaphore);
30 int sem_unlink(const char* name);
32 int sem_init(sem_t* semaphore, int shared, unsigned value);
33 int sem_destroy(sem_t* semaphore);
35 int sem_post(sem_t* semaphore);
36 int sem_timedwait(sem_t* semaphore, const struct timespec* timeout);
37 int sem_trywait(sem_t* semaphore);
38 int sem_wait(sem_t* semaphore);
39 int sem_getvalue(sem_t* semaphore, int* value);
41 __END_DECLS
44 #endif /* _SEMAPHORE_H_ */