brickOS Kernel Developer v0.9.0
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(__sys_critsec_h__)
29#define __sys_critsec_h__
30
31#if defined(__cplusplus)
32extern "C" {
33#endif // __cplusplus
34
35#include <config.h>
36#include <atomic.h>
37
38#if defined(CONF_TM)
40#define INITIALIZE_KERNEL_CRITICAL_SECTION() kernel_critsec_count=0
41#define ENTER_KERNEL_CRITICAL_SECTION() atomic_inc(&kernel_critsec_count)
42#define LEAVE_KERNEL_CRITICAL_SECTION() atomic_dec(&kernel_critsec_count)
43#define DESTROY_KERNEL_CRITICAL_SECTION()
44#else // CONF_TM
45#define INITIALIZE_KERNEL_CRITICAL_SECTION()
46#define ENTER_KERNEL_CRITICAL_SECTION()
47#define LEAVE_KERNEL_CRITICAL_SECTION()
48#define DESTROY_KERNEL_CRITICAL_SECTION()
49#endif // CONF_TM
50
51#if defined(__cplusplus)
52}
53#endif // __cplusplus
54
55#endif // __sys_critsec_h__
56
Interface: critical section management.
volatile unsigned char atomic_t
The data type that allows for atomic count operations.
Definition atomic.h:43
kernel configuration file
atomic_t kernel_critsec_count
critical section counter for kernel/task manager
Definition critsec.c:17