[PATCH 3/5] score: Return prev state in thread state set/clear

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


---
 cpukit/score/include/rtems/score/threadimpl.h | 8 ++++++--
 cpukit/score/src/threadclearstate.c           | 4 +++-
 cpukit/score/src/threadsetstate.c             | 4 +++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index 551df45..dcbb71f 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -248,11 +248,13 @@ void _Thread_Ready(
  *  any necessary scheduling operations including the selection of
  *  a new heir thread.
  *
+ *  @return The previous state.
+ *
  *  - INTERRUPT LATENCY:
  *    + priority map
  *    + select heir
  */
-void _Thread_Clear_state(
+States_Control _Thread_Clear_state(
   Thread_Control *the_thread,
   States_Control  state
 );
@@ -267,11 +269,13 @@ void _Thread_Clear_state(
  *  @param[in] the_thread is the thread to set the state for.
  *  @param[in] state is the state to set the_thread to.
  *
+ *  @return The previous state.
+ *
  *  - INTERRUPT LATENCY:
  *   + ready chain
  *   + select map
  */
-void _Thread_Set_state(
+States_Control _Thread_Set_state(
   Thread_Control *the_thread,
   States_Control  state
 );
diff --git a/cpukit/score/src/threadclearstate.c b/cpukit/score/src/threadclearstate.c
index 3a79f35..00fb83a 100644
--- a/cpukit/score/src/threadclearstate.c
+++ b/cpukit/score/src/threadclearstate.c
@@ -21,7 +21,7 @@
 #include <rtems/score/threadimpl.h>
 #include <rtems/score/schedulerimpl.h>
 
-void _Thread_Clear_state(
+States_Control _Thread_Clear_state(
   Thread_Control *the_thread,
   States_Control  state
 )
@@ -41,4 +41,6 @@ void _Thread_Clear_state(
   }
 
   _Scheduler_Release( the_thread, &lock_context );
+
+  return previous_state;
 }
diff --git a/cpukit/score/src/threadsetstate.c b/cpukit/score/src/threadsetstate.c
index 8114d70..a10fc90 100644
--- a/cpukit/score/src/threadsetstate.c
+++ b/cpukit/score/src/threadsetstate.c
@@ -24,7 +24,7 @@
 #include <rtems/score/threadimpl.h>
 #include <rtems/score/schedulerimpl.h>
 
-void _Thread_Set_state(
+States_Control _Thread_Set_state(
   Thread_Control *the_thread,
   States_Control  state
 )
@@ -44,4 +44,6 @@ void _Thread_Set_state(
   }
 
   _Scheduler_Release( the_thread, &lock_context );
+
+  return previous_state;
 }
-- 
1.8.4.5




More information about the devel mailing list