1
/*
2
* \brief Semaphores
3
* \author Christian Helmuth
4
* \date 2008-09-15
5
*/
6
7
/*
8
* Copyright (C) 2008-2013 Genode Labs GmbH
9
*
10
* This file is part of the Genode OS framework, which is distributed
11
* under the terms of the GNU General Public License version 2.
12
*/
13
14
#
ifndef _INCLUDE__DDE_KIT__SEMAPHORE_H_
15
#
define _INCLUDE__DDE_KIT__SEMAPHORE_H_
16
17
struct
dde_kit_sem;
18
typedef
struct
dde_kit_sem dde_kit_sem_t;
19
20
/**
21
* Initialize DDE kit semaphore
22
*
23
* \param value initial semaphore counter
24
*
25
* \return pointer to new semaphore
26
*/
27
dde_kit_sem_t *
dde_kit_sem_init(
int
value
)
;
28
29
/**
30
* Deinitialize semaphore
31
*
32
* \param sem semaphore reference
33
*/
34
void
dde_kit_sem_deinit(
dde_kit_sem_t *
sem
)
;
35
36
/**
37
* Acquire semaphore
38
*
39
* \param sem semaphore reference
40
*/
41
void
dde_kit_sem_down(
dde_kit_sem_t *
sem
)
;
42
43
/**
44
* Acquire semaphore (non-blocking)
45
*
46
* \param sem semaphore reference
47
*
48
* \return semaphore state
49
* \retval 0 semaphore was acquired
50
* \retval !=0 semaphore was not acquired
51
*/
52
int
dde_kit_sem_down_try(
dde_kit_sem_t *
sem
)
;
53
54
/**
55
* Acquire semaphore (with timeout)
56
*
57
* \param sem semaphore reference
58
* \param timeout timeout (in ms)
59
*
60
* \return semaphore state
61
* \retval 0 semaphore was acquired
62
* \retval !=0 semaphore was not acquired
63
*/
64
//int dde_kit_sem_down_timed(dde_kit_sem_t *sem, int timout);
65
66
/**
67
* Release semaphore
68
*
69
* \param sem semaphore reference
70
*/
71
void
dde_kit_sem_up(
dde_kit_sem_t *
sem
)
;
72
73
#
endif /* _INCLUDE__DDE_KIT__SEMAPHORE_H_ */