kernel: some boottime sanitychecks
[minix.git] / include / ddekit / semaphore.h
blob1f1affe2e4a3a1e25bc4f5e7030ce540a015d192
1 #ifndef _DDEKIT_SEMAPHORE_H
2 #define _DDEKIT_SEMAPHORE_H
4 #include <ddekit/ddekit.h>
7 /** \defgroup DDEKit_synchronization */
9 struct ddekit_sem;
10 typedef struct ddekit_sem ddekit_sem_t;
12 /** Initialize DDEKit semaphore.
14 * \ingroup DDEKit_synchronization
16 * \param value initial semaphore counter
18 ddekit_sem_t *ddekit_sem_init(int value);
20 /** Uninitialize semaphore.
22 * \ingroup DDEKit_synchronization
24 void ddekit_sem_deinit(ddekit_sem_t *sem);
26 /** Semaphore down method. */
27 void ddekit_sem_down(ddekit_sem_t *sem);
29 /** Semaphore down method, non-blocking.
31 * \ingroup DDEKit_synchronization
33 * \return 0 success
34 * \return !=0 would block
36 int ddekit_sem_down_try(ddekit_sem_t *sem);
38 /** Semaphore down with timeout.
40 * \ingroup DDEKit_synchronization
42 * \return 0 success
43 * \return !=0 would block
45 int ddekit_sem_down_timed(ddekit_sem_t *sem, int timo);
47 /** Semaphore up method.
49 * \ingroup DDEKit_synchronization
51 void ddekit_sem_up(ddekit_sem_t *sem);
53 #endif