[rtems commit] score: Delete redundant thread life enums

Sebastian Huber sebh at rtems.org
Fri May 20 05:56:42 UTC 2016


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri May 13 10:21:37 2016 +0200

score: Delete redundant thread life enums

This makes it easier to add more states in the future.

Update #2555.
Update #2626.

---

 cpukit/score/include/rtems/score/thread.h     | 9 ++++-----
 cpukit/score/include/rtems/score/threadimpl.h | 3 ++-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index b8e0e00..d69967b 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -518,16 +518,15 @@ typedef struct {
  * The thread life states are orthogonal to the thread states used for
  * synchronization primitives and blocking operations.  They reflect the state
  * changes triggered with thread restart and delete requests.
+ *
+ * The individual state values must be a power of two to allow use of bit
+ * operations to manipulate and evaluate the thread life state.
  */
 typedef enum {
   THREAD_LIFE_NORMAL = 0x0,
   THREAD_LIFE_PROTECTED = 0x1,
   THREAD_LIFE_RESTARTING = 0x2,
-  THREAD_LIFE_PROTECTED_RESTARTING = 0x3,
-  THREAD_LIFE_TERMINATING = 0x4,
-  THREAD_LIFE_PROTECTED_TERMINATING = 0x5,
-  THREAD_LIFE_RESTARTING_TERMINATING = 0x6,
-  THREAD_LIFE_PROTECTED_RESTARTING_TERMINATING = 0x7
+  THREAD_LIFE_TERMINATING = 0x4
 } Thread_Life_state;
 
 /**
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index 1ea49dd..3fdc2e8 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -943,7 +943,8 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_life_changing(
   Thread_Life_state life_state
 )
 {
-  return ( life_state & THREAD_LIFE_RESTARTING_TERMINATING ) != 0;
+  return ( life_state
+    & ( THREAD_LIFE_RESTARTING | THREAD_LIFE_TERMINATING ) ) != 0;
 }
 
 /**



More information about the vc mailing list