1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup ScoreUserExt |
---|
5 | * |
---|
6 | * @brief User Extension Handler implementation. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2007. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.com/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #if HAVE_CONFIG_H |
---|
19 | #include "config.h" |
---|
20 | #endif |
---|
21 | |
---|
22 | #include <rtems/system.h> |
---|
23 | #include <rtems/score/userext.h> |
---|
24 | |
---|
25 | void _User_extensions_Thread_begin ( |
---|
26 | Thread_Control *executing |
---|
27 | ) |
---|
28 | { |
---|
29 | Chain_Node *the_node; |
---|
30 | User_extensions_Control *the_extension; |
---|
31 | |
---|
32 | for ( the_node = _Chain_First( &_User_extensions_List ); |
---|
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_begin != NULL ) |
---|
39 | (*the_extension->Callouts.thread_begin)( executing ); |
---|
40 | } |
---|
41 | } |
---|
42 | |
---|
43 | void _User_extensions_Thread_exitted ( |
---|
44 | Thread_Control *executing |
---|
45 | ) |
---|
46 | { |
---|
47 | Chain_Node *the_node; |
---|
48 | User_extensions_Control *the_extension; |
---|
49 | |
---|
50 | for ( the_node = _Chain_Last( &_User_extensions_List ); |
---|
51 | !_Chain_Is_head( &_User_extensions_List, the_node ) ; |
---|
52 | the_node = the_node->previous ) { |
---|
53 | |
---|
54 | the_extension = (User_extensions_Control *) the_node; |
---|
55 | |
---|
56 | if ( the_extension->Callouts.thread_exitted != NULL ) |
---|
57 | (*the_extension->Callouts.thread_exitted)( executing ); |
---|
58 | } |
---|
59 | } |
---|
60 | |
---|
61 | void _User_extensions_Fatal ( |
---|
62 | Internal_errors_Source the_source, |
---|
63 | bool is_internal, |
---|
64 | Internal_errors_t the_error |
---|
65 | ) |
---|
66 | { |
---|
67 | Chain_Node *the_node; |
---|
68 | User_extensions_Control *the_extension; |
---|
69 | |
---|
70 | for ( the_node = _Chain_Last( &_User_extensions_List ); |
---|
71 | !_Chain_Is_head( &_User_extensions_List, the_node ) ; |
---|
72 | the_node = the_node->previous ) { |
---|
73 | |
---|
74 | the_extension = (User_extensions_Control *) the_node; |
---|
75 | |
---|
76 | if ( the_extension->Callouts.fatal != NULL ) |
---|
77 | (*the_extension->Callouts.fatal)( the_source, is_internal, the_error ); |
---|
78 | } |
---|
79 | } |
---|