1 | /* |
---|
2 | * User Extension Handler |
---|
3 | * |
---|
4 | * NOTE: XXX |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989-1999. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.OARcorp.com/rtems/license.html. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #include <rtems/system.h> |
---|
17 | #include <rtems/score/userext.h> |
---|
18 | |
---|
19 | /*PAGE |
---|
20 | * |
---|
21 | * _User_extensions_Thread_create |
---|
22 | */ |
---|
23 | |
---|
24 | boolean _User_extensions_Thread_create ( |
---|
25 | Thread_Control *the_thread |
---|
26 | ) |
---|
27 | { |
---|
28 | Chain_Node *the_node; |
---|
29 | User_extensions_Control *the_extension; |
---|
30 | boolean status; |
---|
31 | |
---|
32 | for ( the_node = _User_extensions_List.first ; |
---|
33 | !_Chain_Is_tail( &_User_extensions_List, the_node ) ; |
---|
34 | the_node = the_node->next ) { |
---|
35 | |
---|
36 | the_extension = (User_extensions_Control *) the_node; |
---|
37 | |
---|
38 | if ( the_extension->Callouts.thread_create != NULL ) { |
---|
39 | status = (*the_extension->Callouts.thread_create)( |
---|
40 | _Thread_Executing, |
---|
41 | the_thread |
---|
42 | ); |
---|
43 | if ( !status ) |
---|
44 | return FALSE; |
---|
45 | } |
---|
46 | } |
---|
47 | |
---|
48 | return TRUE; |
---|
49 | } |
---|
50 | |
---|
51 | /*PAGE |
---|
52 | * |
---|
53 | * _User_extensions_Thread_delete |
---|
54 | */ |
---|
55 | |
---|
56 | void _User_extensions_Thread_delete ( |
---|
57 | Thread_Control *the_thread |
---|
58 | ) |
---|
59 | { |
---|
60 | Chain_Node *the_node; |
---|
61 | User_extensions_Control *the_extension; |
---|
62 | |
---|
63 | for ( the_node = _User_extensions_List.last ; |
---|
64 | !_Chain_Is_head( &_User_extensions_List, the_node ) ; |
---|
65 | the_node = the_node->previous ) { |
---|
66 | |
---|
67 | the_extension = (User_extensions_Control *) the_node; |
---|
68 | |
---|
69 | if ( the_extension->Callouts.thread_delete != NULL ) |
---|
70 | (*the_extension->Callouts.thread_delete)( |
---|
71 | _Thread_Executing, |
---|
72 | the_thread |
---|
73 | ); |
---|
74 | } |
---|
75 | } |
---|
76 | |
---|
77 | /*PAGE |
---|
78 | * |
---|
79 | * _User_extensions_Thread_start |
---|
80 | * |
---|
81 | */ |
---|
82 | |
---|
83 | void _User_extensions_Thread_start ( |
---|
84 | Thread_Control *the_thread |
---|
85 | ) |
---|
86 | { |
---|
87 | Chain_Node *the_node; |
---|
88 | User_extensions_Control *the_extension; |
---|
89 | |
---|
90 | for ( the_node = _User_extensions_List.first ; |
---|
91 | !_Chain_Is_tail( &_User_extensions_List, the_node ) ; |
---|
92 | the_node = the_node->next ) { |
---|
93 | |
---|
94 | the_extension = (User_extensions_Control *) the_node; |
---|
95 | |
---|
96 | if ( the_extension->Callouts.thread_start != NULL ) |
---|
97 | (*the_extension->Callouts.thread_start)( |
---|
98 | _Thread_Executing, |
---|
99 | the_thread |
---|
100 | ); |
---|
101 | } |
---|
102 | } |
---|
103 | |
---|
104 | /*PAGE |
---|
105 | * |
---|
106 | * _User_extensions_Thread_restart |
---|
107 | * |
---|
108 | */ |
---|
109 | |
---|
110 | void _User_extensions_Thread_restart ( |
---|
111 | Thread_Control *the_thread |
---|
112 | ) |
---|
113 | { |
---|
114 | Chain_Node *the_node; |
---|
115 | User_extensions_Control *the_extension; |
---|
116 | |
---|
117 | for ( the_node = _User_extensions_List.first ; |
---|
118 | !_Chain_Is_tail( &_User_extensions_List, the_node ) ; |
---|
119 | the_node = the_node->next ) { |
---|
120 | |
---|
121 | the_extension = (User_extensions_Control *) the_node; |
---|
122 | |
---|
123 | if ( the_extension->Callouts.thread_restart != NULL ) |
---|
124 | (*the_extension->Callouts.thread_restart)( |
---|
125 | _Thread_Executing, |
---|
126 | the_thread |
---|
127 | ); |
---|
128 | } |
---|
129 | } |
---|
130 | |
---|
131 | /*PAGE |
---|
132 | * |
---|
133 | * _User_extensions_Thread_begin |
---|
134 | * |
---|
135 | */ |
---|
136 | |
---|
137 | void _User_extensions_Thread_begin ( |
---|
138 | Thread_Control *executing |
---|
139 | ) |
---|
140 | { |
---|
141 | Chain_Node *the_node; |
---|
142 | User_extensions_Control *the_extension; |
---|
143 | |
---|
144 | for ( the_node = _User_extensions_List.first ; |
---|
145 | !_Chain_Is_tail( &_User_extensions_List, the_node ) ; |
---|
146 | the_node = the_node->next ) { |
---|
147 | |
---|
148 | the_extension = (User_extensions_Control *) the_node; |
---|
149 | |
---|
150 | if ( the_extension->Callouts.thread_begin != NULL ) |
---|
151 | (*the_extension->Callouts.thread_begin)( executing ); |
---|
152 | } |
---|
153 | } |
---|
154 | |
---|
155 | /*PAGE |
---|
156 | * |
---|
157 | * _User_extensions_Thread_exitted |
---|
158 | */ |
---|
159 | |
---|
160 | void _User_extensions_Thread_exitted ( |
---|
161 | Thread_Control *executing |
---|
162 | ) |
---|
163 | { |
---|
164 | Chain_Node *the_node; |
---|
165 | User_extensions_Control *the_extension; |
---|
166 | |
---|
167 | for ( the_node = _User_extensions_List.last ; |
---|
168 | !_Chain_Is_head( &_User_extensions_List, the_node ) ; |
---|
169 | the_node = the_node->previous ) { |
---|
170 | |
---|
171 | the_extension = (User_extensions_Control *) the_node; |
---|
172 | |
---|
173 | if ( the_extension->Callouts.thread_exitted != NULL ) |
---|
174 | (*the_extension->Callouts.thread_exitted)( executing ); |
---|
175 | } |
---|
176 | } |
---|
177 | |
---|
178 | /*PAGE |
---|
179 | * |
---|
180 | * _User_extensions_Fatal |
---|
181 | */ |
---|
182 | |
---|
183 | void _User_extensions_Fatal ( |
---|
184 | Internal_errors_Source the_source, |
---|
185 | boolean is_internal, |
---|
186 | unsigned32 the_error |
---|
187 | ) |
---|
188 | { |
---|
189 | Chain_Node *the_node; |
---|
190 | User_extensions_Control *the_extension; |
---|
191 | |
---|
192 | for ( the_node = _User_extensions_List.last ; |
---|
193 | !_Chain_Is_head( &_User_extensions_List, the_node ) ; |
---|
194 | the_node = the_node->previous ) { |
---|
195 | |
---|
196 | the_extension = (User_extensions_Control *) the_node; |
---|
197 | |
---|
198 | if ( the_extension->Callouts.fatal != NULL ) |
---|
199 | (*the_extension->Callouts.fatal)( the_source, is_internal, the_error ); |
---|
200 | } |
---|
201 | } |
---|
202 | |
---|
203 | |
---|