diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-10-14 13:03:46 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-11-02 10:05:42 +0100 |
commit | edb020ca678c78e4a1a7ba4becbc46a2d6bf24c7 (patch) | |
tree | 5b553a93e8825967adc9e3e191d56b6769a305cf /cpukit/score/include/rtems/score/schedulerimpl.h | |
parent | score: Protect thread scheduler state changes (diff) | |
download | rtems-edb020ca678c78e4a1a7ba4becbc46a2d6bf24c7.tar.bz2 |
score: Protect thread CPU by thread scheduler lock
Update #2556.
Diffstat (limited to 'cpukit/score/include/rtems/score/schedulerimpl.h')
-rw-r--r-- | cpukit/score/include/rtems/score/schedulerimpl.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h index 7c74765a29..6d2f5a1981 100644 --- a/cpukit/score/include/rtems/score/schedulerimpl.h +++ b/cpukit/score/include/rtems/score/schedulerimpl.h @@ -1102,10 +1102,11 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Exchange_idle_thread( * @param[in] is_scheduled This node is scheduled. * @param[in] get_idle_thread Function to get an idle thread. * - * @retval true Continue with the blocking operation. - * @retval false Otherwise. + * @retval thread_cpu The processor of the thread. Indicates to continue with + * the blocking operation. + * @retval NULL Otherwise. */ -RTEMS_INLINE_ROUTINE bool _Scheduler_Block_node( +RTEMS_INLINE_ROUTINE Per_CPU_Control *_Scheduler_Block_node( Scheduler_Context *context, Thread_Control *thread, Scheduler_Node *node, @@ -1116,15 +1117,17 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_Block_node( ISR_lock_Context lock_context; Thread_Control *old_user; Thread_Control *new_user; + Per_CPU_Control *thread_cpu; _Thread_Scheduler_acquire_critical( thread, &lock_context ); + thread_cpu = _Thread_Get_CPU( thread ); _Scheduler_Thread_change_state( thread, THREAD_SCHEDULER_BLOCKED ); _Thread_Scheduler_release_critical( thread, &lock_context ); if ( node->help_state == SCHEDULER_HELP_YOURSELF ) { _Assert( thread == _Scheduler_Node_get_user( node ) ); - return true; + return thread_cpu; } new_user = NULL; @@ -1166,7 +1169,7 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_Block_node( _Thread_Dispatch_update_heir( _Per_CPU_Get(), cpu, new_user ); } - return false; + return NULL; } /** |