1 | /** |
---|
2 | * @file rtems/score/corerwlock.h |
---|
3 | * |
---|
4 | * @brief Constants and Structures Associated with the RWLock Handler |
---|
5 | * |
---|
6 | * This include file contains all the constants and structures associated |
---|
7 | * with the RWLock Handler. |
---|
8 | */ |
---|
9 | |
---|
10 | /* |
---|
11 | * COPYRIGHT (c) 1989-2008. |
---|
12 | * On-Line Applications Research Corporation (OAR). |
---|
13 | * |
---|
14 | * The license and distribution terms for this file may be |
---|
15 | * found in the file LICENSE in this distribution or at |
---|
16 | * http://www.rtems.com/license/LICENSE. |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _RTEMS_SCORE_CORERWLOCK_H |
---|
20 | #define _RTEMS_SCORE_CORERWLOCK_H |
---|
21 | |
---|
22 | #include <rtems/score/threadq.h> |
---|
23 | |
---|
24 | /** |
---|
25 | * @defgroup ScoreRWLock RWLock Handler |
---|
26 | * |
---|
27 | * @ingroup Score |
---|
28 | * |
---|
29 | * This handler encapsulates functionality which provides the foundation |
---|
30 | * RWLock services used in all of the APIs supported by RTEMS. |
---|
31 | */ |
---|
32 | /**@{*/ |
---|
33 | |
---|
34 | #ifdef __cplusplus |
---|
35 | extern "C" { |
---|
36 | #endif |
---|
37 | |
---|
38 | /** |
---|
39 | * RWLock State. |
---|
40 | */ |
---|
41 | typedef enum { |
---|
42 | /** This indicates the the RWLock is not currently locked. |
---|
43 | */ |
---|
44 | CORE_RWLOCK_UNLOCKED, |
---|
45 | /** This indicates the the RWLock is currently locked for reading. |
---|
46 | */ |
---|
47 | CORE_RWLOCK_LOCKED_FOR_READING, |
---|
48 | /** This indicates the the RWLock is currently locked for reading. |
---|
49 | */ |
---|
50 | CORE_RWLOCK_LOCKED_FOR_WRITING |
---|
51 | } CORE_RWLock_States; |
---|
52 | |
---|
53 | /** |
---|
54 | * The following defines the control block used to manage the |
---|
55 | * attributes of each RWLock. |
---|
56 | */ |
---|
57 | typedef struct { |
---|
58 | /** This field indicates XXX. |
---|
59 | */ |
---|
60 | int XXX; |
---|
61 | } CORE_RWLock_Attributes; |
---|
62 | |
---|
63 | /** |
---|
64 | * The following defines the control block used to manage each |
---|
65 | * RWLock. |
---|
66 | */ |
---|
67 | typedef struct { |
---|
68 | /** This field is the Waiting Queue used to manage the set of tasks |
---|
69 | * which are blocked waiting for the RWLock to be released. |
---|
70 | */ |
---|
71 | Thread_queue_Control Wait_queue; |
---|
72 | /** This element is the set of attributes which define this instance's |
---|
73 | * behavior. |
---|
74 | */ |
---|
75 | CORE_RWLock_Attributes Attributes; |
---|
76 | /** This element is the current state of the RWLock. |
---|
77 | */ |
---|
78 | CORE_RWLock_States current_state; |
---|
79 | /** This element contains the current number of thread waiting for this |
---|
80 | * RWLock to be released. */ |
---|
81 | uint32_t number_of_readers; |
---|
82 | } CORE_RWLock_Control; |
---|
83 | |
---|
84 | /**@}*/ |
---|
85 | |
---|
86 | #ifdef __cplusplus |
---|
87 | } |
---|
88 | #endif |
---|
89 | |
---|
90 | #endif |
---|
91 | /* end of include file */ |
---|