critsec.h
Go to the documentation of this file.
1
8
/*
9
* The contents of this file are subject to the Mozilla Public License
10
* Version 1.0 (the "License"); you may not use this file except in
11
* compliance with the License. You may obtain a copy of the License
12
* at http://www.mozilla.org/MPL/
13
*
14
* Software distributed under the License is distributed on an "AS IS"
15
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
16
* the License for the specific language governing rights and
17
* limitations under the License.
18
*
19
* The Original Code is legOS code, released October 17, 1999.
20
*
21
* The Initial Developer of the Original Code is Markus L. Noga.
22
* Portions created by Markus L. Noga are Copyright (C) 1999
23
* Markus L. Noga. All Rights Reserved.
24
*
25
* Contributor(s): Joseph A. Woolley <jawoolley@users.sourceforge.net>
26
*/
27
28
#if !defined(__critsec_h__)
29
#define __critsec_h__
30
31
#if defined(__cplusplus)
32
extern
"C"
{
33
#endif // __cplusplus
34
35
#include <config.h>
36
37
#if defined(CONF_TM) && defined(CONF_CRITICAL_SECTIONS)
38
#include <sys/tm.h>
39
#include <
atomic.h
>
40
41
#ifndef DOXYGEN_SHOULD_SKIP_INTERNALS
42
48
struct
critsec {
49
atomic_t
count;
50
tdata_t* task;
51
};
52
#endif // DOXYGEN_SHOULD_SKIP_INTERNALS
53
55
typedef
struct
critsec
critsec_t
;
56
58
60
#define locked_decrement(counter) atomic_dec(counter)
61
63
69
extern
wakeup_t
wait_critical_section
(
wakeup_t
data);
70
72
79
#define initialize_critical_section(cs) (cs)->count=0
80
82
90
extern
int
enter_critical_section
(
critsec_t
* cs);
91
93
101
#define leave_critical_section(cs) atomic_dec(&(cs)->count)
102
104
111
#define destroy_critical_section(cs)
112
113
#endif // CONF_TM && CONF_CRITICAL_SECTIONS
114
115
#if defined(__cplusplus)
116
}
117
#endif // __cplusplus
118
119
#endif // __critsec_h__
critsec_t
struct critsec critsec_t
critical section type definition
Definition:
critsec.h:55
wakeup_t
unsigned long wakeup_t
wakeup data area type
Definition:
tm.h:57
atomic_t
volatile unsigned char atomic_t
The data type that allows for atomic count operations.
Definition:
atomic.h:43
atomic.h
Interface: critical section management.
wait_critical_section
wakeup_t wait_critical_section(wakeup_t data)
wakeup when critical section is available
enter_critical_section
int enter_critical_section(critsec_t *cs)
enter critical section
brickOS
is released under the
Mozilla Public License
.
Original code copyright 1998-2005 by the authors.
Generated for brickOS C++ by
1.8.16