From 26333f2ad09fc2ecd574fb167862520493c63ee3 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 8 Feb 2019 10:16:07 +0100 Subject: score: Fix _User_extensions_Thread_switch() (SMP) We have to read the first node again once we obtained the lock since it may have aready changed. --- cpukit/include/rtems/score/userextimpl.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'cpukit/include/rtems') diff --git a/cpukit/include/rtems/score/userextimpl.h b/cpukit/include/rtems/score/userextimpl.h index 77486598c4..77357b9fed 100644 --- a/cpukit/include/rtems/score/userextimpl.h +++ b/cpukit/include/rtems/score/userextimpl.h @@ -256,9 +256,13 @@ static inline void _User_extensions_Thread_switch( Thread_Control *heir ) { - const Chain_Control *chain = &_User_extensions_Switches_list; - const Chain_Node *tail = _Chain_Immutable_tail( chain ); - const Chain_Node *node = _Chain_Immutable_first( chain ); + const Chain_Control *chain; + const Chain_Node *tail; + const Chain_Node *node; + + chain = &_User_extensions_Switches_list; + tail = _Chain_Immutable_tail( chain ); + node = _Chain_Immutable_first( chain ); if ( node != tail ) { Per_CPU_Control *cpu_self; @@ -273,6 +277,10 @@ static inline void _User_extensions_Thread_switch( #endif _Per_CPU_Acquire( cpu_self ); +#if defined(RTEMS_SMP) + node = _Chain_Immutable_first( chain ); +#endif + while ( node != tail ) { const User_extensions_Switch_control *extension = (const User_extensions_Switch_control *) node; -- cgit v1.2.3