1/*
2 * Copyright (c) 2011, ETH Zurich.
3 * All rights reserved.
4 *
5 * This file is distributed under the terms in the attached LICENSE file.
6 * If you do not find this file, copies can be found by writing to:
7 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
8 */
9
10#ifndef SEMAPHORE_H
11#define SEMAPHORE_H
12
13#include <barrelfish/thread_sync.h>
14#include <sys/cdefs.h>
15
16__BEGIN_DECLS
17
18struct posix_semaphore {
19    int pshared;
20    struct thread_sem thread_sem;
21    uint32_t id;
22};
23
24typedef struct posix_semaphore sem_t;
25
26int sem_init(sem_t *sem, int pshared, unsigned int value);
27int sem_destroy(sem_t *sem);
28int sem_wait(sem_t *sem);
29int sem_trywait(sem_t *sem);
30int sem_post(sem_t *sem);
31
32__END_DECLS
33
34#endif
35