diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-17 10:12:14 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-31 08:29:43 +0200 |
commit | 5c731a83485ce3e7a6b6556e7a38b92d10a98cd6 (patch) | |
tree | bee44daeabdb237541a911283651f43c91b1c049 /cpukit/score/src/threadrestart.c | |
parent | score: Delete post-switch API extensions (diff) | |
download | rtems-5c731a83485ce3e7a6b6556e7a38b92d10a98cd6.tar.bz2 |
score: Use thread action for thread restart
The thread restart is now supported on SMP. New test
smptests/smpthreadlife01.
Diffstat (limited to 'cpukit/score/src/threadrestart.c')
-rw-r--r-- | cpukit/score/src/threadrestart.c | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c index b9a7dd56ae..d982f720e7 100644 --- a/cpukit/score/src/threadrestart.c +++ b/cpukit/score/src/threadrestart.c @@ -20,32 +20,52 @@ #include <rtems/score/threadimpl.h> #include <rtems/score/userextimpl.h> -#include <rtems/config.h> -bool _Thread_Restart( +void _Thread_Life_action_handler( + Thread_Control *executing, + Thread_Action *action, + Per_CPU_Control *cpu, + ISR_Level level +) +{ + (void) action; + _Thread_Action_release_and_ISR_enable( cpu, level ); + + _Thread_Disable_dispatch(); + + _Thread_Load_environment( executing ); + _Thread_Restart_self( executing ); +} + +static void _Thread_Request_life_change( Thread_Control *the_thread, void *pointer_argument, Thread_Entry_numeric_type numeric_argument ) { -#if defined( RTEMS_SMP ) - if ( - rtems_configuration_is_smp_enabled() - && !_Thread_Is_executing( the_thread ) - ) { - return false; - } -#endif + _Thread_Set_transient( the_thread ); - if ( !_States_Is_dormant( the_thread->current_state ) ) { + _Thread_Reset( the_thread, pointer_argument, numeric_argument ); - _Thread_Set_transient( the_thread ); + _Thread_Add_post_switch_action( the_thread, &the_thread->Life.Action ); - _Thread_Reset( the_thread, pointer_argument, numeric_argument ); + _Thread_Ready( the_thread ); - _Thread_Load_environment( the_thread ); + _Thread_Request_dispatch_if_executing( the_thread ); +} - _Thread_Ready( the_thread ); +bool _Thread_Restart( + Thread_Control *the_thread, + void *pointer_argument, + Thread_Entry_numeric_type numeric_argument +) +{ + if ( !_States_Is_dormant( the_thread->current_state ) ) { + _Thread_Request_life_change( + the_thread, + pointer_argument, + numeric_argument + ); _User_extensions_Thread_restart( the_thread ); |