summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c/src/exec/rtems/src/signal.c3
-rw-r--r--c/src/exec/rtems/src/tasks.c10
-rw-r--r--c/src/exec/sapi/headers/extension.h2
-rw-r--r--c/src/exec/sapi/include/rtems/extension.h2
-rw-r--r--c/src/exec/score/headers/apiext.h22
-rw-r--r--c/src/exec/score/headers/thread.h1
-rw-r--r--c/src/exec/score/headers/userext.h20
-rw-r--r--c/src/exec/score/include/rtems/score/apiext.h22
-rw-r--r--c/src/exec/score/include/rtems/score/thread.h1
-rw-r--r--c/src/exec/score/include/rtems/score/userext.h20
-rw-r--r--c/src/exec/score/inline/rtems/score/userext.inl24
-rw-r--r--c/src/exec/score/inline/userext.inl24
-rw-r--r--c/src/exec/score/macros/rtems/score/userext.inl9
-rw-r--r--c/src/exec/score/macros/userext.inl9
-rw-r--r--c/src/exec/score/src/apiext.c21
-rw-r--r--c/src/exec/score/src/thread.c7
-rw-r--r--cpukit/rtems/src/signal.c3
-rw-r--r--cpukit/rtems/src/tasks.c10
-rw-r--r--cpukit/sapi/include/rtems/extension.h2
-rw-r--r--cpukit/score/include/rtems/score/apiext.h22
-rw-r--r--cpukit/score/include/rtems/score/thread.h1
-rw-r--r--cpukit/score/include/rtems/score/userext.h20
-rw-r--r--cpukit/score/inline/rtems/score/userext.inl24
-rw-r--r--cpukit/score/macros/rtems/score/userext.inl9
-rw-r--r--cpukit/score/src/apiext.c21
-rw-r--r--cpukit/score/src/thread.c7
26 files changed, 132 insertions, 184 deletions
diff --git a/c/src/exec/rtems/src/signal.c b/c/src/exec/rtems/src/signal.c
index 6b0dfdc3e5..10aefa391c 100644
--- a/c/src/exec/rtems/src/signal.c
+++ b/c/src/exec/rtems/src/signal.c
@@ -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 {
diff --git a/c/src/exec/rtems/src/tasks.c b/c/src/exec/rtems/src/tasks.c
index 99ec426dd6..0b30fcce69 100644
--- a/c/src/exec/rtems/src/tasks.c
+++ b/c/src/exec/rtems/src/tasks.c
@@ -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;
+ }
}
}
diff --git a/c/src/exec/sapi/headers/extension.h b/c/src/exec/sapi/headers/extension.h
index 1b9ea1a75a..0d6433fa5e 100644
--- a/c/src/exec/sapi/headers/extension.h
+++ b/c/src/exec/sapi/headers/extension.h
@@ -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;
diff --git a/c/src/exec/sapi/include/rtems/extension.h b/c/src/exec/sapi/include/rtems/extension.h
index 1b9ea1a75a..0d6433fa5e 100644
--- a/c/src/exec/sapi/include/rtems/extension.h
+++ b/c/src/exec/sapi/include/rtems/extension.h
@@ -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;
diff --git a/c/src/exec/score/headers/apiext.h b/c/src/exec/score/headers/apiext.h
index 594c71d25c..44e7bc8dd3 100644
--- a/c/src/exec/score/headers/apiext.h
+++ b/c/src/exec/score/headers/apiext.h
@@ -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 */
diff --git a/c/src/exec/score/headers/thread.h b/c/src/exec/score/headers/thread.h
index d2ffb41093..94909a3a18 100644
--- a/c/src/exec/score/headers/thread.h
+++ b/c/src/exec/score/headers/thread.h
@@ -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;
diff --git a/c/src/exec/score/headers/userext.h b/c/src/exec/score/headers/userext.h
index 424871e895..58fa087780 100644
--- a/c/src/exec/score/headers/userext.h
+++ b/c/src/exec/score/headers/userext.h
@@ -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;
@@ -230,21 +225,6 @@ STATIC INLINE void _User_extensions_Thread_switch (
);
/*
- * _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
*
* DESCRIPTION:
diff --git a/c/src/exec/score/include/rtems/score/apiext.h b/c/src/exec/score/include/rtems/score/apiext.h
index 594c71d25c..44e7bc8dd3 100644
--- a/c/src/exec/score/include/rtems/score/apiext.h
+++ b/c/src/exec/score/include/rtems/score/apiext.h
@@ -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 */
diff --git a/c/src/exec/score/include/rtems/score/thread.h b/c/src/exec/score/include/rtems/score/thread.h
index d2ffb41093..94909a3a18 100644
--- a/c/src/exec/score/include/rtems/score/thread.h
+++ b/c/src/exec/score/include/rtems/score/thread.h
@@ -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;
diff --git a/c/src/exec/score/include/rtems/score/userext.h b/c/src/exec/score/include/rtems/score/userext.h
index 424871e895..58fa087780 100644
--- a/c/src/exec/score/include/rtems/score/userext.h
+++ b/c/src/exec/score/include/rtems/score/userext.h
@@ -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;
@@ -230,21 +225,6 @@ STATIC INLINE void _User_extensions_Thread_switch (
);
/*
- * _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
*
* DESCRIPTION:
diff --git a/c/src/exec/score/inline/rtems/score/userext.inl b/c/src/exec/score/inline/rtems/score/userext.inl
index 697a7eddd0..2b4483c553 100644
--- a/c/src/exec/score/inline/rtems/score/userext.inl
+++ b/c/src/exec/score/inline/rtems/score/userext.inl
@@ -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 */
diff --git a/c/src/exec/score/inline/userext.inl b/c/src/exec/score/inline/userext.inl
index 697a7eddd0..2b4483c553 100644
--- a/c/src/exec/score/inline/userext.inl
+++ b/c/src/exec/score/inline/userext.inl
@@ -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 */
diff --git a/c/src/exec/score/macros/rtems/score/userext.inl b/c/src/exec/score/macros/rtems/score/userext.inl
index 2daa37494d..4b5b8083bf 100644
--- a/c/src/exec/score/macros/rtems/score/userext.inl
+++ b/c/src/exec/score/macros/rtems/score/userext.inl
@@ -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 */
diff --git a/c/src/exec/score/macros/userext.inl b/c/src/exec/score/macros/userext.inl
index 2daa37494d..4b5b8083bf 100644
--- a/c/src/exec/score/macros/userext.inl
+++ b/c/src/exec/score/macros/userext.inl
@@ -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 */
diff --git a/c/src/exec/score/src/apiext.c b/c/src/exec/score/src/apiext.c
index 68d80bed07..6e82b49a53 100644
--- a/c/src/exec/score/src/apiext.c
+++ b/c/src/exec/score/src/apiext.c
@@ -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 */
diff --git a/c/src/exec/score/src/thread.c b/c/src/exec/score/src/thread.c
index b44da17c67..7cda6e5108 100644
--- a/c/src/exec/score/src/thread.c
+++ b/c/src/exec/score/src/thread.c
@@ -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;
diff --git a/cpukit/rtems/src/signal.c b/cpukit/rtems/src/signal.c
index 6b0dfdc3e5..10aefa391c 100644
--- a/cpukit/rtems/src/signal.c
+++ b/cpukit/rtems/src/signal.c
@@ -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 {
diff --git a/cpukit/rtems/src/tasks.c b/cpukit/rtems/src/tasks.c
index 99ec426dd6..0b30fcce69 100644
--- a/cpukit/rtems/src/tasks.c
+++ b/cpukit/rtems/src/tasks.c
@@ -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;
+ }
}
}
diff --git a/cpukit/sapi/include/rtems/extension.h b/cpukit/sapi/include/rtems/extension.h
index 1b9ea1a75a..0d6433fa5e 100644
--- a/cpukit/sapi/include/rtems/extension.h
+++ b/cpukit/sapi/include/rtems/extension.h
@@ -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;
diff --git a/cpukit/score/include/rtems/score/apiext.h b/cpukit/score/include/rtems/score/apiext.h
index 594c71d25c..44e7bc8dd3 100644
--- a/cpukit/score/include/rtems/score/apiext.h
+++ b/cpukit/score/include/rtems/score/apiext.h
@@ -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 */
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index d2ffb41093..94909a3a18 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -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;
diff --git a/cpukit/score/include/rtems/score/userext.h b/cpukit/score/include/rtems/score/userext.h
index 424871e895..58fa087780 100644
--- a/cpukit/score/include/rtems/score/userext.h
+++ b/cpukit/score/include/rtems/score/userext.h
@@ -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;
@@ -230,21 +225,6 @@ STATIC INLINE void _User_extensions_Thread_switch (
);
/*
- * _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
*
* DESCRIPTION:
diff --git a/cpukit/score/inline/rtems/score/userext.inl b/cpukit/score/inline/rtems/score/userext.inl
index 697a7eddd0..2b4483c553 100644
--- a/cpukit/score/inline/rtems/score/userext.inl
+++ b/cpukit/score/inline/rtems/score/userext.inl
@@ -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 */
diff --git a/cpukit/score/macros/rtems/score/userext.inl b/cpukit/score/macros/rtems/score/userext.inl
index 2daa37494d..4b5b8083bf 100644
--- a/cpukit/score/macros/rtems/score/userext.inl
+++ b/cpukit/score/macros/rtems/score/userext.inl
@@ -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 */
diff --git a/cpukit/score/src/apiext.c b/cpukit/score/src/apiext.c
index 68d80bed07..6e82b49a53 100644
--- a/cpukit/score/src/apiext.c
+++ b/cpukit/score/src/apiext.c
@@ -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 */
diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c
index b44da17c67..7cda6e5108 100644
--- a/cpukit/score/src/thread.c
+++ b/cpukit/score/src/thread.c
@@ -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;