RTEMS 6.1-rc2
|
This group contains the User Extensions Handler implementation. More...
Data Structures | |
struct | User_extensions_Table |
User extension table. More... | |
struct | User_extensions_Switch_control |
Manages the switch callouts. More... | |
struct | User_extensions_Control |
Manages each user extension set. More... | |
struct | User_extensions_Iterator |
Chain iterator for dynamic user extensions. More... | |
struct | User_extensions_List |
struct | User_extensions_Thread_create_context |
struct | User_extensions_Fatal_context |
Typedefs | |
typedef bool(* | User_extensions_thread_create_extension) (struct _Thread_Control *executing, struct _Thread_Control *created) |
Task create extension. | |
typedef void(* | User_extensions_thread_delete_extension) (struct _Thread_Control *executing, struct _Thread_Control *deleted) |
Task delete extension. | |
typedef void(* | User_extensions_thread_start_extension) (struct _Thread_Control *executing, struct _Thread_Control *started) |
Task start extension. | |
typedef void(* | User_extensions_thread_restart_extension) (struct _Thread_Control *executing, struct _Thread_Control *restarted) |
Task restart extension. | |
typedef void(* | User_extensions_thread_switch_extension) (struct _Thread_Control *executing, struct _Thread_Control *heir) |
Task switch extension. | |
typedef void(* | User_extensions_thread_begin_extension) (struct _Thread_Control *executing) |
Task begin extension. | |
typedef void(* | User_extensions_thread_exitted_extension) (struct _Thread_Control *executing) |
Task exitted extension. | |
typedef void(* | User_extensions_fatal_extension) (Internal_errors_Source source, bool always_set_to_false, Internal_errors_t code) |
Fatal error extension. | |
typedef void(* | User_extensions_thread_terminate_extension) (struct _Thread_Control *terminated) |
Task termination extension. | |
typedef struct User_extensions_Iterator | User_extensions_Iterator |
Chain iterator for dynamic user extensions. | |
Variables | |
const size_t | _User_extensions_Initial_count |
The count of initial user extensions. | |
const User_extensions_Table | _User_extensions_Initial_extensions [] |
The table of initial user extensions. | |
User_extensions_Switch_control | _User_extensions_Initial_switch_controls [] |
A spare switch control for each initial user extension. | |
User_extensions_List | _User_extensions_List |
List of active extensions. | |
Chain_Control | _User_extensions_Switches_list |
List of active task switch extensions. | |
Extension Maintainance | |
typedef void(* | User_extensions_Visitor) (Thread_Control *executing, void *arg, const User_extensions_Table *callouts) |
User extension visitor. | |
void | _User_extensions_Handler_initialization (void) |
Initializes the user extensions handler. | |
void | _User_extensions_Add_set (User_extensions_Control *extension) |
Adds a user extension. | |
void | _User_extensions_Remove_set (User_extensions_Control *extension) |
Removes a user extension. | |
void | _User_extensions_Thread_create_visitor (Thread_Control *executing, void *arg, const User_extensions_Table *callouts) |
Creates a visitor. | |
void | _User_extensions_Thread_delete_visitor (Thread_Control *executing, void *arg, const User_extensions_Table *callouts) |
Deletes a visitor. | |
void | _User_extensions_Thread_start_visitor (Thread_Control *executing, void *arg, const User_extensions_Table *callouts) |
Starts a visitor. | |
void | _User_extensions_Thread_restart_visitor (Thread_Control *executing, void *arg, const User_extensions_Table *callouts) |
Restarts a visitor. | |
void | _User_extensions_Thread_begin_visitor (Thread_Control *executing, void *arg, const User_extensions_Table *callouts) |
Calls the begin function of the thread callout for the visitor. | |
void | _User_extensions_Thread_exitted_visitor (Thread_Control *executing, void *arg, const User_extensions_Table *callouts) |
Calls the exitted function of the thread callout for the visitor. | |
void | _User_extensions_Fatal_visitor (Thread_Control *executing, void *arg, const User_extensions_Table *callouts) |
Calls the fatal function of the thread callout for the visitor. | |
void | _User_extensions_Thread_terminate_visitor (Thread_Control *executing, void *arg, const User_extensions_Table *callouts) |
Terminates a visitor. | |
void | _User_extensions_Iterate (void *arg, User_extensions_Visitor visitor, Chain_Iterator_direction direction) |
Iterates through all user extensions and calls the visitor for each. | |
This group contains the User Extensions Handler implementation.
This handler provides the invocation of application dependent routines at critical points in the life of each thread and the system as a whole.
typedef void(* User_extensions_fatal_extension) (Internal_errors_Source source, bool always_set_to_false, Internal_errors_t code) |
Fatal error extension.
It corresponds to _Terminate() (used by the rtems_fatal() directive).
This extension should not call any RTEMS directives.
[in] | source | The fatal source indicating the subsystem the fatal condition originated in. |
[in] | always_set_to_false | This parameter is always set to false and provided only for backward compatibility reasons. |
[in] | code | The fatal error code. This value must be interpreted with respect to the source. |
typedef struct User_extensions_Iterator User_extensions_Iterator |
Chain iterator for dynamic user extensions.
Since user extensions may delete or restart the executing thread, we must clean up registered iterators.
typedef void(* User_extensions_thread_begin_extension) (struct _Thread_Control *executing) |
Task begin extension.
It corresponds to _Thread_Handler().
Thread dispatching is disabled. The executing thread is not the holder of the allocator mutex.
[in] | executing | The executing thread. |
typedef bool(* User_extensions_thread_create_extension) (struct _Thread_Control *executing, struct _Thread_Control *created) |
Task create extension.
It corresponds to _Thread_Initialize() (used by the rtems_task_create() directive and pthread_create()).
It is invoked after the new thread has been completely initialized, but before it is placed on a ready chain.
Thread dispatching may be disabled. This depends on the context of the _Thread_Initialize() call. Thread dispatch is disabled during the creation of the idle thread and the initialization threads. It can be considered as an invalid API usage, if the application calls _Thread_Initialize() with disabled thread dispatching. Disabled thread dispatching is different from disabled preemption.
It can be assumed that the executing thread locked the allocator mutex. The only exception is the creation of the idle thread. In this case the allocator mutex is not locked. Since the allocator mutex allows nesting the normal memory allocation routines can be used.
[in] | executing | The executing thread. |
[in] | created | The created thread. |
true | Successful operation. |
false | A thread create user extension will frequently attempt to allocate resources. If this allocation fails, then the extension should return false and the entire thread create operation will fail. |
typedef void(* User_extensions_thread_delete_extension) (struct _Thread_Control *executing, struct _Thread_Control *deleted) |
Task delete extension.
It corresponds to _Thread_Close() (used by the rtems_task_delete() directive, pthread_exit() and pthread_cancel()).
It is invoked before all resources of the thread are deleted. The executing and deleted arguments are never equal.
Thread dispatching is enabled. The executing thread locked the allocator mutex.
[in] | executing | The executing thread. |
[in] | deleted | The deleted thread. |
typedef void(* User_extensions_thread_exitted_extension) (struct _Thread_Control *executing) |
Task exitted extension.
It corresponds to _Thread_Handler() after a return of the entry function.
Thread dispatching is disabled. The state of the allocator mutex is arbitrary.
[in] | executing | The executing thread. |
typedef void(* User_extensions_thread_restart_extension) (struct _Thread_Control *executing, struct _Thread_Control *restarted) |
Task restart extension.
It corresponds to _Thread_Restart() (used by the rtems_task_restart() directive).
It is invoked in the context of the restarted thread right before the execution context is reloaded. The executing and restarted arguments are always equal. The thread stack reflects the previous execution context.
Thread dispatching is enabled. The thread is not the holder of the allocator mutex. The thread life is protected. Thread restart and delete requests issued by restart extensions lead to recursion.
[in] | executing | The executing thread. |
[in] | restarted | The executing thread. Yes, the executing thread. |
typedef void(* User_extensions_thread_start_extension) (struct _Thread_Control *executing, struct _Thread_Control *started) |
Task start extension.
It corresponds to _Thread_Start() (used by the rtems_task_start() directive).
It is invoked after the environment of the thread has been loaded and the thread has been made ready.
Thread dispatching is disabled. The executing thread is not the holder of the allocator mutex.
[in] | executing | The executing thread. |
[in] | started | The started thread. |
typedef void(* User_extensions_thread_switch_extension) (struct _Thread_Control *executing, struct _Thread_Control *heir) |
Task switch extension.
It corresponds to _Thread_Dispatch().
It is invoked before the context switch from the executing to the heir thread.
Thread dispatching is disabled. The state of the allocator mutex is arbitrary. Interrupts are disabled and the per-CPU lock is acquired on SMP configurations.
The context switches initiated through _Thread_Start_multitasking() are not covered by this extension.
[in] | executing | The executing thread. |
[in] | heir | The heir thread. |
typedef void(* User_extensions_thread_terminate_extension) (struct _Thread_Control *terminated) |
Task termination extension.
This extension is invoked by _Thread_Life_action_handler() in case a termination request is recognized.
It is invoked in the context of the terminated thread right before the thread dispatch to the heir thread. The POSIX cleanup and key destructors execute in this context.
Thread dispatching is enabled. The thread is not the holder of the allocator mutex. The thread life is protected. Thread restart and delete requests issued by terminate extensions lead to recursion.
[in] | terminated | The terminated thread. |
typedef void(* User_extensions_Visitor) (Thread_Control *executing, void *arg, const User_extensions_Table *callouts) |
User extension visitor.
[in,out] | executing | The currently executing thread. |
[in,out] | arg | The argument passed to _User_extensions_Iterate(). |
[in] | callouts | The current callouts. |
void _User_extensions_Add_set | ( | User_extensions_Control * | extension | ) |
Adds a user extension.
extension | The user extension to add. |
void _User_extensions_Fatal_visitor | ( | Thread_Control * | executing, |
void * | arg, | ||
const User_extensions_Table * | callouts | ||
) |
Calls the fatal function of the thread callout for the visitor.
executing | The currently executing thread. |
arg | Is used as the user extension fatal context. |
callouts | The user extension table for the operation. |
void _User_extensions_Iterate | ( | void * | arg, |
User_extensions_Visitor | visitor, | ||
Chain_Iterator_direction | direction | ||
) |
Iterates through all user extensions and calls the visitor for each.
[in,out] | arg | The argument passed to the visitor. |
visitor | The visitor for each extension. | |
direction | The iteration direction for dynamic extensions. |
void _User_extensions_Remove_set | ( | User_extensions_Control * | extension | ) |
Removes a user extension.
extension | The user extension to remove. |
void _User_extensions_Thread_begin_visitor | ( | Thread_Control * | executing, |
void * | arg, | ||
const User_extensions_Table * | callouts | ||
) |
Calls the begin function of the thread callout for the visitor.
executing | The currently executing thread. |
arg | This parameter is unused. |
callouts | The user extension table for the operation. |
void _User_extensions_Thread_create_visitor | ( | Thread_Control * | executing, |
void * | arg, | ||
const User_extensions_Table * | callouts | ||
) |
Creates a visitor.
executing | The currently executing thread. | |
[in,out] | arg | Is used as the thread create context for the operation. |
callouts | The user extension table for the operation. |
void _User_extensions_Thread_delete_visitor | ( | Thread_Control * | executing, |
void * | arg, | ||
const User_extensions_Table * | callouts | ||
) |
Deletes a visitor.
executing | The currently executing thread. | |
[in,out] | arg | Parameter for the callout. |
callouts | The user extension table for the operation. |
void _User_extensions_Thread_exitted_visitor | ( | Thread_Control * | executing, |
void * | arg, | ||
const User_extensions_Table * | callouts | ||
) |
Calls the exitted function of the thread callout for the visitor.
executing | The currently executing thread. |
arg | This parameter is unused. |
callouts | The user extension table for the operation. |
void _User_extensions_Thread_restart_visitor | ( | Thread_Control * | executing, |
void * | arg, | ||
const User_extensions_Table * | callouts | ||
) |
Restarts a visitor.
executing | The currently executing thread. |
arg | Parameter for the callout. |
callouts | The user extension table for the operation. |
void _User_extensions_Thread_start_visitor | ( | Thread_Control * | executing, |
void * | arg, | ||
const User_extensions_Table * | callouts | ||
) |
Starts a visitor.
executing | The currently executing thread. |
arg | Parameter for the callout. |
callouts | The user extension table for the operation. |
void _User_extensions_Thread_terminate_visitor | ( | Thread_Control * | executing, |
void * | arg, | ||
const User_extensions_Table * | callouts | ||
) |
Terminates a visitor.
executing | The currently executing thread. |
arg | This parameter is unused. |
callouts | The user extension table for the operation. |
|
extern |
The count of initial user extensions.
Application provided via <rtems/confdefs.h>.
|
extern |
The table of initial user extensions.
Application provided via <rtems/confdefs.h>.
|
extern |
A spare switch control for each initial user extension.
Application provided via <rtems/confdefs.h>.