[5072b07] | 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> |
---|
[3a4ae6c] | 18 | #include <rtems/core/userext.h> |
---|
[5072b07] | 19 | |
---|
| 20 | /*PAGE |
---|
| 21 | * |
---|
[3a4ae6c] | 22 | * _User_extensions_Thread_create |
---|
[5072b07] | 23 | */ |
---|
| 24 | |
---|
[3a4ae6c] | 25 | boolean _User_extensions_Thread_create ( |
---|
[5072b07] | 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 | |
---|
[3a4ae6c] | 39 | if ( the_extension->Callouts.thread_create != NULL ) { |
---|
| 40 | status = (*the_extension->Callouts.thread_create)( |
---|
[5072b07] | 41 | _Thread_Executing, |
---|
| 42 | the_thread |
---|
| 43 | ); |
---|
| 44 | if ( !status ) |
---|
| 45 | return FALSE; |
---|
| 46 | } |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | return TRUE; |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | /*PAGE |
---|
| 53 | * |
---|
[3a4ae6c] | 54 | * _User_extensions_Thread_delete |
---|
[5072b07] | 55 | */ |
---|
| 56 | |
---|
[3a4ae6c] | 57 | void _User_extensions_Thread_delete ( |
---|
[5072b07] | 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 | |
---|
[3a4ae6c] | 70 | if ( the_extension->Callouts.thread_delete != NULL ) |
---|
| 71 | (*the_extension->Callouts.thread_delete)( |
---|
[5072b07] | 72 | _Thread_Executing, |
---|
| 73 | the_thread |
---|
| 74 | ); |
---|
| 75 | } |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | /*PAGE |
---|
| 79 | * |
---|
[3a4ae6c] | 80 | * _User_extensions_Thread_start |
---|
[5072b07] | 81 | * |
---|
| 82 | */ |
---|
| 83 | |
---|
[3a4ae6c] | 84 | void _User_extensions_Thread_start ( |
---|
[5072b07] | 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 | |
---|
[3a4ae6c] | 97 | if ( the_extension->Callouts.thread_start != NULL ) |
---|
| 98 | (*the_extension->Callouts.thread_start)( |
---|
[5072b07] | 99 | _Thread_Executing, |
---|
| 100 | the_thread |
---|
| 101 | ); |
---|
| 102 | } |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | /*PAGE |
---|
| 106 | * |
---|
[3a4ae6c] | 107 | * _User_extensions_Thread_restart |
---|
[5072b07] | 108 | * |
---|
| 109 | */ |
---|
| 110 | |
---|
[3a4ae6c] | 111 | void _User_extensions_Thread_restart ( |
---|
[5072b07] | 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 | |
---|
[3a4ae6c] | 124 | if ( the_extension->Callouts.thread_restart != NULL ) |
---|
| 125 | (*the_extension->Callouts.thread_restart)( |
---|
[5072b07] | 126 | _Thread_Executing, |
---|
| 127 | the_thread |
---|
| 128 | ); |
---|
| 129 | } |
---|
| 130 | } |
---|
| 131 | |
---|
| 132 | /*PAGE |
---|
| 133 | * |
---|
[3a4ae6c] | 134 | * _User_extensions_Thread_begin |
---|
[5072b07] | 135 | * |
---|
| 136 | */ |
---|
| 137 | |
---|
[3a4ae6c] | 138 | void _User_extensions_Thread_begin ( |
---|
[5072b07] | 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 | |
---|
[3a4ae6c] | 151 | if ( the_extension->Callouts.thread_begin != NULL ) |
---|
| 152 | (*the_extension->Callouts.thread_begin)( executing ); |
---|
[5072b07] | 153 | } |
---|
| 154 | } |
---|
| 155 | |
---|
| 156 | /*PAGE |
---|
| 157 | * |
---|
[3a4ae6c] | 158 | * _User_extensions_Thread_exitted |
---|
[5072b07] | 159 | */ |
---|
| 160 | |
---|
[3a4ae6c] | 161 | void _User_extensions_Thread_exitted ( |
---|
[5072b07] | 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 | |
---|
[3a4ae6c] | 174 | if ( the_extension->Callouts.thread_exitted != NULL ) |
---|
| 175 | (*the_extension->Callouts.thread_exitted)( executing ); |
---|
[5072b07] | 176 | } |
---|
| 177 | } |
---|
| 178 | |
---|
| 179 | /*PAGE |
---|
| 180 | * |
---|
| 181 | * _User_extensions_Fatal |
---|
| 182 | */ |
---|
| 183 | |
---|
| 184 | void _User_extensions_Fatal ( |
---|
[3a4ae6c] | 185 | Internal_errors_Source the_source, |
---|
| 186 | boolean is_internal, |
---|
| 187 | unsigned32 the_error |
---|
[5072b07] | 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 ) |
---|
[3a4ae6c] | 200 | (*the_extension->Callouts.fatal)( the_source, is_internal, the_error ); |
---|
[5072b07] | 201 | } |
---|
| 202 | } |
---|
| 203 | |
---|
| 204 | |
---|