[PATCH 1/5] score: Simplify _Thread_Clear_state()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Mar 31 06:00:03 UTC 2015


---
 cpukit/score/src/threadclearstate.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/cpukit/score/src/threadclearstate.c b/cpukit/score/src/threadclearstate.c
index c60fb8f..3a79f35 100644
--- a/cpukit/score/src/threadclearstate.c
+++ b/cpukit/score/src/threadclearstate.c
@@ -27,18 +27,17 @@ void _Thread_Clear_state(
 )
 {
   ISR_lock_Context lock_context;
-  States_Control   current_state;
+  States_Control   previous_state;
+  States_Control   next_state;
 
   _Scheduler_Acquire( the_thread, &lock_context );
 
-  current_state = the_thread->current_state;
-  if ( current_state & state ) {
-    current_state =
-    the_thread->current_state = _States_Clear( state, current_state );
+  previous_state = the_thread->current_state;
+  next_state = _States_Clear( state, previous_state );
+  the_thread->current_state = next_state;
 
-    if ( _States_Is_ready( current_state ) ) {
-      _Scheduler_Unblock( the_thread );
-    }
+  if ( _States_Is_ready( next_state ) ) {
+    _Scheduler_Unblock( the_thread );
   }
 
   _Scheduler_Release( the_thread, &lock_context );
-- 
1.8.4.5



More information about the devel mailing list