blob: c959919d92477efea24993c465b10c774925ceb5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#ifndef _ddekit_semaphore_h
#define _ddekit_semaphore_h
/** \defgroup DDEKit_synchronization */
struct ddekit_sem;
typedef struct ddekit_sem ddekit_sem_t;
/** Initialize DDEKit semaphore.
*
* \ingroup DDEKit_synchronization
*
* \param value initial semaphore counter
*/
ddekit_sem_t *ddekit_sem_init(int value);
/** Uninitialize semaphore.
*
* \ingroup DDEKit_synchronization
*/
void ddekit_sem_deinit(ddekit_sem_t *sem);
/** Semaphore down method. */
void ddekit_sem_down(ddekit_sem_t *sem);
/** Semaphore down method, non-blocking.
*
* \ingroup DDEKit_synchronization
*
* \return 0 success
* \return !=0 would block
*/
int ddekit_sem_down_try(ddekit_sem_t *sem);
/** Semaphore down with timeout.
*
* \ingroup DDEKit_synchronization
*
* \return 0 success
* \return !=0 would block
*/
int ddekit_sem_down_timed(ddekit_sem_t *sem, int timo);
/** Semaphore up method.
*
* \ingroup DDEKit_synchronization
*/
void ddekit_sem_up(ddekit_sem_t *sem);
#endif
|