mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-27 23:10:16 +00:00
changed post task extension from user set to api set and added flag
in each thread which must be set when the post switch extension is to be run.
This commit is contained in:
@@ -130,6 +130,9 @@ rtems_status_code rtems_signal_send(
|
||||
if ( ! _ASR_Is_null_handler( asr->handler ) ) {
|
||||
if ( asr->is_enabled ) {
|
||||
_ASR_Post_signals( signal_set, &asr->signals_posted );
|
||||
|
||||
the_thread->do_post_task_switch_extension = TRUE;
|
||||
|
||||
if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
|
||||
_ISR_Signals_to_thread_executing = TRUE;
|
||||
} else {
|
||||
|
||||
@@ -100,7 +100,7 @@ User_extensions_routine _RTEMS_tasks_Delete_extension(
|
||||
* XXX
|
||||
*/
|
||||
|
||||
User_extensions_routine _RTEMS_tasks_Switch_extension(
|
||||
void _RTEMS_tasks_Switch_extension(
|
||||
Thread_Control *executing
|
||||
)
|
||||
{
|
||||
@@ -135,7 +135,8 @@ User_extensions_routine _RTEMS_tasks_Switch_extension(
|
||||
API_extensions_Control _RTEMS_tasks_API_extensions = {
|
||||
{ NULL, NULL },
|
||||
NULL, /* predriver */
|
||||
_RTEMS_tasks_Initialize_user_tasks /* postdriver */
|
||||
_RTEMS_tasks_Initialize_user_tasks, /* postdriver */
|
||||
_RTEMS_tasks_Switch_extension /* post switch */
|
||||
};
|
||||
|
||||
User_extensions_Control _RTEMS_tasks_User_extensions = {
|
||||
@@ -145,7 +146,6 @@ User_extensions_Control _RTEMS_tasks_User_extensions = {
|
||||
_RTEMS_tasks_Start_extension, /* restart */
|
||||
_RTEMS_tasks_Delete_extension, /* delete */
|
||||
NULL, /* switch */
|
||||
_RTEMS_tasks_Switch_extension, /* post switch */
|
||||
NULL, /* begin */
|
||||
NULL, /* exitted */
|
||||
NULL /* fatal */
|
||||
@@ -806,8 +806,10 @@ rtems_status_code rtems_task_mode(
|
||||
if ( is_asr_enabled != asr->is_enabled ) {
|
||||
asr->is_enabled = is_asr_enabled;
|
||||
_ASR_Swap_signals( asr );
|
||||
if ( _ASR_Are_signals_pending( asr ) )
|
||||
if ( _ASR_Are_signals_pending( asr ) ) {
|
||||
needs_asr_dispatching = TRUE;
|
||||
executing->do_post_task_switch_extension = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,6 @@ typedef User_extensions_thread_delete_extension rtems_task_delete_extension;
|
||||
typedef User_extensions_thread_start_extension rtems_task_start_extension;
|
||||
typedef User_extensions_thread_restart_extension rtems_task_restart_extension;
|
||||
typedef User_extensions_thread_switch_extension rtems_task_switch_extension;
|
||||
typedef User_extensions_thread_post_switch_extension
|
||||
rtems_task_post_switch_extension;
|
||||
typedef User_extensions_thread_begin_extension rtems_task_begin_extension;
|
||||
typedef User_extensions_thread_exitted_extension rtems_task_exitted_extension;
|
||||
typedef User_extensions_fatal_extension rtems_fatal_extension;
|
||||
|
||||
@@ -43,8 +43,6 @@ typedef User_extensions_thread_delete_extension rtems_task_delete_extension;
|
||||
typedef User_extensions_thread_start_extension rtems_task_start_extension;
|
||||
typedef User_extensions_thread_restart_extension rtems_task_restart_extension;
|
||||
typedef User_extensions_thread_switch_extension rtems_task_switch_extension;
|
||||
typedef User_extensions_thread_post_switch_extension
|
||||
rtems_task_post_switch_extension;
|
||||
typedef User_extensions_thread_begin_extension rtems_task_begin_extension;
|
||||
typedef User_extensions_thread_exitted_extension rtems_task_exitted_extension;
|
||||
typedef User_extensions_fatal_extension rtems_fatal_extension;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#define __API_EXTENSIONS_h
|
||||
|
||||
#include <rtems/score/chain.h>
|
||||
#include <rtems/score/thread.h>
|
||||
|
||||
/*
|
||||
* The control structure which defines the points at which an API
|
||||
@@ -26,11 +27,16 @@
|
||||
|
||||
typedef void (*API_extensions_Predriver_hook)(void);
|
||||
typedef void (*API_extensions_Postdriver_hook)(void);
|
||||
typedef void (*API_extensions_Postswitch_hook)(
|
||||
Thread_Control *
|
||||
);
|
||||
|
||||
|
||||
typedef struct {
|
||||
Chain_Node Node;
|
||||
API_extensions_Predriver_hook predriver_hook;
|
||||
API_extensions_Postdriver_hook postdriver_hook;
|
||||
Chain_Node Node;
|
||||
API_extensions_Predriver_hook predriver_hook;
|
||||
API_extensions_Postdriver_hook postdriver_hook;
|
||||
API_extensions_Postswitch_hook postswitch_hook;
|
||||
} API_extensions_Control;
|
||||
|
||||
/*
|
||||
@@ -82,5 +88,15 @@ void _API_extensions_Run_predriver( void );
|
||||
|
||||
void _API_extensions_Run_postdriver( void );
|
||||
|
||||
/*
|
||||
* _API_extensions_Run_postswitch
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
void _API_extensions_Run_postswitch( void );
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -148,6 +148,7 @@ typedef struct {
|
||||
MP_packet_Prefix *receive_packet;
|
||||
/****************** end of common block ********************/
|
||||
boolean is_global;
|
||||
boolean do_post_task_switch_extension;
|
||||
Chain_Control *ready;
|
||||
Priority_Information Priority_map;
|
||||
Thread_Start_information Start;
|
||||
|
||||
@@ -60,10 +60,6 @@ typedef User_extensions_routine ( *User_extensions_thread_switch_extension )(
|
||||
Thread_Control *
|
||||
);
|
||||
|
||||
typedef User_extensions_routine (*User_extensions_thread_post_switch_extension)(
|
||||
Thread_Control *
|
||||
);
|
||||
|
||||
typedef User_extensions_routine ( *User_extensions_thread_begin_extension )(
|
||||
Thread_Control *
|
||||
);
|
||||
@@ -85,7 +81,6 @@ typedef struct {
|
||||
User_extensions_thread_restart_extension thread_restart;
|
||||
User_extensions_thread_delete_extension thread_delete;
|
||||
User_extensions_thread_switch_extension thread_switch;
|
||||
User_extensions_thread_post_switch_extension thread_post_switch;
|
||||
User_extensions_thread_begin_extension thread_begin;
|
||||
User_extensions_thread_exitted_extension thread_exitted;
|
||||
User_extensions_fatal_extension fatal;
|
||||
@@ -229,21 +224,6 @@ STATIC INLINE void _User_extensions_Thread_switch (
|
||||
Thread_Control *heir
|
||||
);
|
||||
|
||||
/*
|
||||
* _User_extensions_Thread_post_switch
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is used to invoke the user extension which is invoked
|
||||
* after a context switch occurs (i.e. we are running in the context
|
||||
* of the new thread).
|
||||
*/
|
||||
|
||||
STATIC INLINE void _User_extensions_Thread_post_switch (
|
||||
Thread_Control *executing
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* _User_extensions_Thread_begin
|
||||
*
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#define __API_EXTENSIONS_h
|
||||
|
||||
#include <rtems/score/chain.h>
|
||||
#include <rtems/score/thread.h>
|
||||
|
||||
/*
|
||||
* The control structure which defines the points at which an API
|
||||
@@ -26,11 +27,16 @@
|
||||
|
||||
typedef void (*API_extensions_Predriver_hook)(void);
|
||||
typedef void (*API_extensions_Postdriver_hook)(void);
|
||||
typedef void (*API_extensions_Postswitch_hook)(
|
||||
Thread_Control *
|
||||
);
|
||||
|
||||
|
||||
typedef struct {
|
||||
Chain_Node Node;
|
||||
API_extensions_Predriver_hook predriver_hook;
|
||||
API_extensions_Postdriver_hook postdriver_hook;
|
||||
Chain_Node Node;
|
||||
API_extensions_Predriver_hook predriver_hook;
|
||||
API_extensions_Postdriver_hook postdriver_hook;
|
||||
API_extensions_Postswitch_hook postswitch_hook;
|
||||
} API_extensions_Control;
|
||||
|
||||
/*
|
||||
@@ -82,5 +88,15 @@ void _API_extensions_Run_predriver( void );
|
||||
|
||||
void _API_extensions_Run_postdriver( void );
|
||||
|
||||
/*
|
||||
* _API_extensions_Run_postswitch
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
void _API_extensions_Run_postswitch( void );
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -148,6 +148,7 @@ typedef struct {
|
||||
MP_packet_Prefix *receive_packet;
|
||||
/****************** end of common block ********************/
|
||||
boolean is_global;
|
||||
boolean do_post_task_switch_extension;
|
||||
Chain_Control *ready;
|
||||
Priority_Information Priority_map;
|
||||
Thread_Start_information Start;
|
||||
|
||||
@@ -60,10 +60,6 @@ typedef User_extensions_routine ( *User_extensions_thread_switch_extension )(
|
||||
Thread_Control *
|
||||
);
|
||||
|
||||
typedef User_extensions_routine (*User_extensions_thread_post_switch_extension)(
|
||||
Thread_Control *
|
||||
);
|
||||
|
||||
typedef User_extensions_routine ( *User_extensions_thread_begin_extension )(
|
||||
Thread_Control *
|
||||
);
|
||||
@@ -85,7 +81,6 @@ typedef struct {
|
||||
User_extensions_thread_restart_extension thread_restart;
|
||||
User_extensions_thread_delete_extension thread_delete;
|
||||
User_extensions_thread_switch_extension thread_switch;
|
||||
User_extensions_thread_post_switch_extension thread_post_switch;
|
||||
User_extensions_thread_begin_extension thread_begin;
|
||||
User_extensions_thread_exitted_extension thread_exitted;
|
||||
User_extensions_fatal_extension fatal;
|
||||
@@ -229,21 +224,6 @@ STATIC INLINE void _User_extensions_Thread_switch (
|
||||
Thread_Control *heir
|
||||
);
|
||||
|
||||
/*
|
||||
* _User_extensions_Thread_post_switch
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is used to invoke the user extension which is invoked
|
||||
* after a context switch occurs (i.e. we are running in the context
|
||||
* of the new thread).
|
||||
*/
|
||||
|
||||
STATIC INLINE void _User_extensions_Thread_post_switch (
|
||||
Thread_Control *executing
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* _User_extensions_Thread_begin
|
||||
*
|
||||
|
||||
@@ -99,29 +99,5 @@ STATIC INLINE void _User_extensions_Thread_switch (
|
||||
}
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _User_extensions_Thread_post_switch
|
||||
*
|
||||
*/
|
||||
|
||||
STATIC INLINE void _User_extensions_Thread_post_switch (
|
||||
Thread_Control *executing
|
||||
)
|
||||
{
|
||||
Chain_Node *the_node;
|
||||
User_extensions_Control *the_extension;
|
||||
|
||||
for ( the_node = _User_extensions_List.first ;
|
||||
!_Chain_Is_tail( &_User_extensions_List, the_node ) ;
|
||||
the_node = the_node->next ) {
|
||||
|
||||
the_extension = (User_extensions_Control *) the_node;
|
||||
|
||||
if ( the_extension->Callouts.thread_post_switch != NULL )
|
||||
(*the_extension->Callouts.thread_post_switch)( executing );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -99,29 +99,5 @@ STATIC INLINE void _User_extensions_Thread_switch (
|
||||
}
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _User_extensions_Thread_post_switch
|
||||
*
|
||||
*/
|
||||
|
||||
STATIC INLINE void _User_extensions_Thread_post_switch (
|
||||
Thread_Control *executing
|
||||
)
|
||||
{
|
||||
Chain_Node *the_node;
|
||||
User_extensions_Control *the_extension;
|
||||
|
||||
for ( the_node = _User_extensions_List.first ;
|
||||
!_Chain_Is_tail( &_User_extensions_List, the_node ) ;
|
||||
the_node = the_node->next ) {
|
||||
|
||||
the_extension = (User_extensions_Control *) the_node;
|
||||
|
||||
if ( the_extension->Callouts.thread_post_switch != NULL )
|
||||
(*the_extension->Callouts.thread_post_switch)( executing );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -122,14 +122,5 @@
|
||||
#define _User_extensions_Thread_switch( _executing, _heir ) \
|
||||
_User_extensions_Run_list_forward(thread_switch, (_executing, _heir) )
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _User_extensions_Thread_post_switch
|
||||
*
|
||||
*/
|
||||
|
||||
#define _User_extensions_Thread_post_switch( _executing ) \
|
||||
_User_extensions_Run_list_forward(thread_post_switch, (_executing) )
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -122,14 +122,5 @@
|
||||
#define _User_extensions_Thread_switch( _executing, _heir ) \
|
||||
_User_extensions_Run_list_forward(thread_switch, (_executing, _heir) )
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _User_extensions_Thread_post_switch
|
||||
*
|
||||
*/
|
||||
|
||||
#define _User_extensions_Thread_post_switch( _executing ) \
|
||||
_User_extensions_Run_list_forward(thread_post_switch, (_executing) )
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -81,4 +81,25 @@ void _API_extensions_Run_postdriver( void )
|
||||
}
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _API_extensions_Run_postswitch
|
||||
*/
|
||||
|
||||
void _API_extensions_Run_postswitch( void )
|
||||
{
|
||||
Chain_Node *the_node;
|
||||
API_extensions_Control *the_extension;
|
||||
|
||||
for ( the_node = _API_extensions_List.first ;
|
||||
!_Chain_Is_tail( &_API_extensions_List, the_node ) ;
|
||||
the_node = the_node->next ) {
|
||||
|
||||
the_extension = (API_extensions_Control *) the_node;
|
||||
|
||||
if ( the_extension->postswitch_hook )
|
||||
(*the_extension->postswitch_hook)( _Thread_Executing );
|
||||
}
|
||||
}
|
||||
|
||||
/* end of file */
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/apiext.h>
|
||||
#include <rtems/score/context.h>
|
||||
#include <rtems/score/interr.h>
|
||||
#include <rtems/score/isr.h>
|
||||
@@ -200,7 +201,10 @@ void _Thread_Dispatch( void )
|
||||
|
||||
_ISR_Enable( level );
|
||||
|
||||
_User_extensions_Thread_post_switch( executing );
|
||||
if ( executing->do_post_task_switch_extension ) {
|
||||
executing->do_post_task_switch_extension = FALSE;
|
||||
_API_extensions_Run_postswitch();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -813,6 +817,7 @@ void _Thread_Load_environment(
|
||||
is_fp = TRUE;
|
||||
}
|
||||
|
||||
the_thread->do_post_task_switch_extension = FALSE;
|
||||
the_thread->is_preemptible = the_thread->Start.is_preemptible;
|
||||
the_thread->is_timeslice = the_thread->Start.is_timeslice;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user