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