[rtems commit] score: Replace _Thread_Reset()

Sebastian Huber sebh at rtems.org
Mon Mar 31 08:09:16 UTC 2014


Module:    rtems
Branch:    master
Commit:    226c731e7a301227c52f2f7d2f10e6bcc9877c78
Changeset: http://git.rtems.org/rtems/commit/?id=226c731e7a301227c52f2f7d2f10e6bcc9877c78

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Mar 25 11:03:21 2014 +0100

score: Replace _Thread_Reset()

Replace _Thread_Reset() with _Thread_Start_life_change().  This function
can be later used for the _Thread_Close() implementation.

---

 cpukit/score/src/threadrestart.c |   41 ++++++++++++++++---------------------
 1 files changed, 18 insertions(+), 23 deletions(-)

diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index 193c6ab..b8fbd23 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -41,39 +41,33 @@ void _Thread_Life_action_handler(
   _Thread_Restart_self( executing );
 }
 
-static void _Thread_Reset( Thread_Control *the_thread )
+static void _Thread_Start_life_change(
+  Thread_Control   *the_thread,
+  Priority_Control  priority
+)
 {
   the_thread->resource_count   = 0;
   the_thread->is_preemptible   = the_thread->Start.is_preemptible;
   the_thread->budget_algorithm = the_thread->Start.budget_algorithm;
   the_thread->budget_callout   = the_thread->Start.budget_callout;
+  the_thread->real_priority    = priority;
 
-  if ( !_Thread_queue_Extract_with_proxy( the_thread ) ) {
-
-    if ( _Watchdog_Is_active( &the_thread->Timer ) )
-      (void) _Watchdog_Remove( &the_thread->Timer );
-  }
-
-  if ( the_thread->current_priority != the_thread->Start.initial_priority ) {
-    the_thread->real_priority = the_thread->Start.initial_priority;
-    _Thread_Set_priority( the_thread, the_thread->Start.initial_priority );
-  }
+  _Thread_Set_transient( the_thread );
+  _Thread_queue_Extract_with_proxy( the_thread );
+  _Watchdog_Remove( &the_thread->Timer );
+  _Thread_Set_priority( the_thread, priority );
+  _Thread_Add_post_switch_action( the_thread, &the_thread->Life.Action );
+  _Thread_Ready( the_thread );
+  _Thread_Request_dispatch_if_executing( the_thread );
 }
 
 static void _Thread_Request_life_change(
-  Thread_Control *the_thread,
-  Thread_Control *executing
+  Thread_Control    *the_thread,
+  Thread_Control    *executing,
+  Priority_Control   priority
 )
 {
-  _Thread_Set_transient( the_thread );
-
-  _Thread_Reset( the_thread );
-
-  _Thread_Add_post_switch_action( the_thread, &the_thread->Life.Action );
-
-  _Thread_Ready( the_thread );
-
-  _Thread_Request_dispatch_if_executing( the_thread );
+  _Thread_Start_life_change( the_thread, priority );
 }
 
 bool _Thread_Restart(
@@ -89,7 +83,8 @@ bool _Thread_Restart(
 
     _Thread_Request_life_change(
       the_thread,
-      executing
+      executing,
+      the_thread->Start.initial_priority
     );
 
     return true;




More information about the vc mailing list