[PATCH 08/32] score: Rework _Thread_Exit()

Sebastian Huber sebastian.huber at embedded-brains.de
Wed May 18 09:20:27 UTC 2016


Rework _Thread_Exit() to use _Thread_Change_life_locked().

Update #2555.
Update #2626.
---
 cpukit/score/src/threadrestart.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index fe9bca1..e2f82a3 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -401,12 +401,24 @@ void _Thread_Close( Thread_Control *the_thread, Thread_Control *executing )
 
 void _Thread_Exit( Thread_Control *executing )
 {
-  _Thread_Request_life_change(
-    executing,
+  ISR_lock_Context lock_context;
+
+  _Assert(
+    _Watchdog_Get_state( &executing->Timer.Watchdog ) == WATCHDOG_INACTIVE
+  );
+  _Assert(
+    executing->current_state == STATES_READY
+      || executing->current_state == STATES_SUSPENDED
+  );
+
+  _Thread_State_acquire( executing, &lock_context );
+  _Thread_Change_life_locked(
     executing,
-    executing->current_priority,
-    THREAD_LIFE_TERMINATING
+    0,
+    THREAD_LIFE_TERMINATING,
+    THREAD_LIFE_PROTECTED
   );
+  _Thread_State_release( executing, &lock_context );
 }
 
 bool _Thread_Restart(
-- 
1.8.4.5




More information about the devel mailing list