1
/*
2
* \brief Locks (i.e., mutex)
3
* \author Christian Helmuth
4
* \date 2008-08-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__LOCK_H_
15
#
define _INCLUDE__DDE_KIT__LOCK_H_
16
17
/**
18
* Private lock type
19
*/
20
struct
dde_kit_lock;
21
22
/**
23
* Initialize lock
24
*
25
* \param out_lock lock handle (output parameter)
26
*
27
* The created lock is free (not acquired) after initialization.
28
*/
29
void
dde_kit_lock_init(
struct
dde_kit_lock *
*
out_lock
)
;
30
31
/**
32
* Destroy lock
33
*
34
* \param lock lock handle
35
*
36
* The old lock handle is invalidated.
37
*/
38
void
dde_kit_lock_deinit(
struct
dde_kit_lock *
lock
)
;
39
40
/**
41
* Acquire lock
42
*
43
* \param lock lock handle
44
*/
45
void
dde_kit_lock_lock(
struct
dde_kit_lock *
lock
)
;
46
47
/**
48
* Acquire a lock (non-blocking)
49
*
50
* \param lock lock handle
51
*
52
* \return lock state
53
* \retval 0 lock was aquired
54
* \retval 1 lock was not aquired
55
*/
56
int
dde_kit_lock_try_lock(
struct
dde_kit_lock *
lock
)
;
57
58
/**
59
* Release lock
60
*
61
* \param lock lock handle
62
*/
63
void
dde_kit_lock_unlock(
struct
dde_kit_lock *
lock
)
;
64
65
#
endif /* _INCLUDE__DDE_KIT__LOCK_H_ */