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/include | |
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 '')
-rw-r--r-- | cpukit/score/include/rtems/score/objectimpl.h | 17 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/thread.h | 5 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/threadimpl.h | 37 |
3 files changed, 38 insertions, 21 deletions
diff --git a/cpukit/score/include/rtems/score/objectimpl.h b/cpukit/score/include/rtems/score/objectimpl.h index 3764c664fd..119f11d829 100644 --- a/cpukit/score/include/rtems/score/objectimpl.h +++ b/cpukit/score/include/rtems/score/objectimpl.h @@ -880,23 +880,6 @@ RTEMS_INLINE_ROUTINE void _Objects_Put_without_thread_dispatch( } /** - * @brief Puts back an object obtained with _Objects_Get(). - * - * The thread dispatch disable level will remain unchanged. - * - * On SMP configurations the Giant lock will be released. - */ -RTEMS_INLINE_ROUTINE void _Objects_Put_and_keep_thread_dispatch_disabled( - Objects_Control *the_object -) -{ - (void) the_object; -#if defined(RTEMS_SMP) - _Giant_Release(); -#endif -} - -/** * @brief Puts back an object obtained with _Objects_Get_isr_disable(). */ RTEMS_INLINE_ROUTINE void _Objects_Put_for_get_isr_disable( diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h index e5a1a55acd..d853aa035a 100644 --- a/cpukit/score/include/rtems/score/thread.h +++ b/cpukit/score/include/rtems/score/thread.h @@ -396,6 +396,10 @@ typedef struct { Chain_Control Chain; } Thread_Action_control; +typedef struct { + Thread_Action Action; +} Thread_Life_control; + /** * This structure defines the Thread Control Block (TCB). */ @@ -543,6 +547,7 @@ struct Thread_Control_struct { */ Chain_Control Key_Chain; + Thread_Life_control Life; }; #if (CPU_PROVIDES_IDLE_THREAD_BODY == FALSE) diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h index bbaa10a2f0..b8647276a5 100644 --- a/cpukit/score/include/rtems/score/threadimpl.h +++ b/cpukit/score/include/rtems/score/threadimpl.h @@ -219,6 +219,13 @@ void _Thread_Reset( Thread_Entry_numeric_type numeric_argument ); +void _Thread_Life_action_handler( + Thread_Control *executing, + Thread_Action *action, + Per_CPU_Control *cpu, + ISR_Level level +); + /** * @brief Frees all memory associated with the specified thread. * @@ -501,21 +508,23 @@ RTEMS_INLINE_ROUTINE void _Thread_Unblock ( * to that of its initial state. */ -RTEMS_INLINE_ROUTINE void _Thread_Restart_self( void ) +RTEMS_INLINE_ROUTINE void _Thread_Restart_self( Thread_Control *executing ) { #if defined(RTEMS_SMP) ISR_Level level; + _Giant_Release(); + _Per_CPU_ISR_disable_and_acquire( _Per_CPU_Get(), level ); ( void ) level; #endif #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) - if ( _Thread_Executing->fp_context != NULL ) - _Context_Restore_fp( &_Thread_Executing->fp_context ); + if ( executing->fp_context != NULL ) + _Context_Restore_fp( &executing->fp_context ); #endif - _CPU_Context_Restart_self( &_Thread_Executing->Registers ); + _CPU_Context_Restart_self( &executing->Registers ); } /** @@ -603,6 +612,26 @@ RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Internal_allocate( void ) return (Thread_Control *) _Objects_Allocate( &_Thread_Internal_information ); } +RTEMS_INLINE_ROUTINE void _Thread_Request_dispatch_if_executing( + Thread_Control *thread +) +{ +#if defined(RTEMS_SMP) + if ( thread->is_executing ) { + const Per_CPU_Control *cpu_of_executing = _Per_CPU_Get(); + Per_CPU_Control *cpu_of_thread = _Thread_Get_CPU( thread ); + + cpu_of_thread->dispatch_necessary = true; + + if ( cpu_of_executing != cpu_of_thread ) { + _Per_CPU_Send_interrupt( cpu_of_thread ); + } + } +#else + (void) thread; +#endif +} + RTEMS_INLINE_ROUTINE void _Thread_Signal_notification( Thread_Control *thread ) { if ( _ISR_Is_in_progress() && _Thread_Is_executing( thread ) ) { |