summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadstartmultitasking.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-06-24 09:31:14 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-06-24 09:31:14 +0200
commit152ad7d1cc9d26eed0186cbb4a40b3b84bf1fee8 (patch)
tree5c2f778475ce8d3087221cc920e2e912f476107d /cpukit/score/src/threadstartmultitasking.c
parentscore: Fix thread deletion on SMP (diff)
downloadrtems-152ad7d1cc9d26eed0186cbb4a40b3b84bf1fee8.tar.bz2
score: Fix _Thread_Start_multitasking() on SMP
The _CPU_Context_Restart_self() implementations usually assume that self context is executing. FIXME: We have a race condition in _Thread_Start_multitasking() in case another thread already performed scheduler operations and moved the heir thread to another processor. The time frame for this is likely too small to be practically relevant.
Diffstat (limited to 'cpukit/score/src/threadstartmultitasking.c')
-rw-r--r--cpukit/score/src/threadstartmultitasking.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/cpukit/score/src/threadstartmultitasking.c b/cpukit/score/src/threadstartmultitasking.c
index c1c8725eae..4467937c58 100644
--- a/cpukit/score/src/threadstartmultitasking.c
+++ b/cpukit/score/src/threadstartmultitasking.c
@@ -61,6 +61,19 @@ void _Thread_Start_multitasking( void )
_Profiling_Thread_dispatch_disable( cpu_self, 0 );
+#if defined(RTEMS_SMP)
+ /*
+ * The _CPU_Context_Restart_self() implementations usually assume that self
+ * context is executing.
+ *
+ * FIXME: We have a race condition here in case another thread already
+ * performed scheduler operations and moved our heir thread to another
+ * processor. The time frame for this is likely too small to be practically
+ * relevant.
+ */
+ _CPU_Context_Set_is_executing( &heir->Registers, true );
+#endif
+
#if defined(_CPU_Start_multitasking)
_CPU_Start_multitasking( &heir->Registers );
#else