[rtems commit] score: Replace STATES_DELAYING

Sebastian Huber sebh at rtems.org
Thu Jan 12 06:55:08 UTC 2017


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Jan 11 08:42:04 2017 +0100

score: Replace STATES_DELAYING

Replace STATES_DELAYING with STATES_WAITING_FOR_TIME.

There is no need for separate timeout thread states.  The
Thread_Control::Timer::header and Watchdog_Control::cpu members can be
used to figure out the kind of timeout.

---

 cpukit/libdebugger/rtems-debugger-threads.c   |  1 -
 cpukit/libmisc/monitor/mon-prmisc.c           |  1 -
 cpukit/posix/src/nanosleep.c                  |  2 +-
 cpukit/rtems/src/taskwakeafter.c              |  2 +-
 cpukit/score/include/rtems/score/statesimpl.h | 43 ++++-----------------------
 5 files changed, 8 insertions(+), 41 deletions(-)

diff --git a/cpukit/libdebugger/rtems-debugger-threads.c b/cpukit/libdebugger/rtems-debugger-threads.c
index 2e9cf06..64d21c4 100644
--- a/cpukit/libdebugger/rtems-debugger-threads.c
+++ b/cpukit/libdebugger/rtems-debugger-threads.c
@@ -514,7 +514,6 @@ rtems_debugger_thread_state_str(rtems_debugger_thread* thread,
     DB_UINT           mask;
   };
   const struct mapper map[] = {
-    { "DELAY",  STATES_DELAYING },
     { "DORM",   STATES_DORMANT },
     { "LIFE",   STATES_LIFE_IS_CHANGING },
     { "SUSP",   STATES_SUSPENDED },
diff --git a/cpukit/libmisc/monitor/mon-prmisc.c b/cpukit/libmisc/monitor/mon-prmisc.c
index 5bb4d42..d5e403c 100644
--- a/cpukit/libmisc/monitor/mon-prmisc.c
+++ b/cpukit/libmisc/monitor/mon-prmisc.c
@@ -115,7 +115,6 @@ rtems_monitor_dump_priority(rtems_task_priority priority)
 #define WITH_ID(state) (STATES_THREAD_QUEUE_WITH_IDENTIFIER | state)
 
 static const rtems_assoc_t rtems_monitor_state_assoc[] = {
-    { "DELAY",  STATES_DELAYING, 0 },
     { "DORM",   STATES_DORMANT, 0 },
     { "LIFE",   STATES_LIFE_IS_CHANGING, 0 },
     { "SUSP",   STATES_SUSPENDED, 0 },
diff --git a/cpukit/posix/src/nanosleep.c b/cpukit/posix/src/nanosleep.c
index 10158ff..13f4536 100644
--- a/cpukit/posix/src/nanosleep.c
+++ b/cpukit/posix/src/nanosleep.c
@@ -49,7 +49,7 @@ static inline int nanosleep_helper(
   _Thread_queue_Context_initialize( &queue_context );
   _Thread_queue_Context_set_thread_state(
     &queue_context,
-    STATES_DELAYING | STATES_INTERRUPTIBLE_BY_SIGNAL
+    STATES_WAITING_FOR_TIME | STATES_INTERRUPTIBLE_BY_SIGNAL
   );
   _Thread_queue_Context_set_enqueue_callout(
     &queue_context,
diff --git a/cpukit/rtems/src/taskwakeafter.c b/cpukit/rtems/src/taskwakeafter.c
index 568b937..faf4a83 100644
--- a/cpukit/rtems/src/taskwakeafter.c
+++ b/cpukit/rtems/src/taskwakeafter.c
@@ -39,7 +39,7 @@ rtems_status_code rtems_task_wake_after(
     if ( ticks == 0 ) {
       _Thread_Yield( executing );
     } else {
-      _Thread_Set_state( executing, STATES_DELAYING );
+      _Thread_Set_state( executing, STATES_WAITING_FOR_TIME );
       _Thread_Wait_flags_set( executing, THREAD_WAIT_STATE_BLOCKED );
       _Thread_Timer_insert_relative(
         executing,
diff --git a/cpukit/score/include/rtems/score/statesimpl.h b/cpukit/score/include/rtems/score/statesimpl.h
index 9751de0..f90a89e 100644
--- a/cpukit/score/include/rtems/score/statesimpl.h
+++ b/cpukit/score/include/rtems/score/statesimpl.h
@@ -74,8 +74,11 @@ extern "C" {
 /** This macro corresponds to a task waiting for BSD wakeup. */
 #define STATES_WAITING_FOR_BSD_WAKEUP          0x00000100
 
-/** This macro corresponds to a task which is waiting for a timeout. */
-#define STATES_DELAYING                        0x00000200
+/**
+ * @brief This macro corresponds to a task which is waiting for a relative or
+ * absolute timeout.
+ */
+#define STATES_WAITING_FOR_TIME                0x00000200
 
 /** This macro corresponds to a task waiting for a period. */
 #define STATES_WAITING_FOR_PERIOD              0x00000400
@@ -104,9 +107,6 @@ extern "C" {
 /** This macro corresponds to a task those life is changing. */
 #define STATES_LIFE_IS_CHANGING                0x00040000
 
-/** This macro corresponds to a task waiting until a specific TOD. */
-#define STATES_WAITING_FOR_TIME                0x00080000
-
 /** This macro corresponds to a task being held by the debugger. */
 #define STATES_DEBUGGER                        0x08000000
 
@@ -139,8 +139,7 @@ extern "C" {
                                  STATES_WAITING_FOR_RWLOCK             )
 
 /** This macro corresponds to a task waiting which is blocked. */
-#define STATES_BLOCKED         ( STATES_DELAYING                | \
-                                 STATES_LOCALLY_BLOCKED         | \
+#define STATES_BLOCKED         ( STATES_LOCALLY_BLOCKED         | \
                                  STATES_WAITING_FOR_TIME        | \
                                  STATES_WAITING_FOR_PERIOD      | \
                                  STATES_WAITING_FOR_EVENT       | \
@@ -246,21 +245,6 @@ RTEMS_INLINE_ROUTINE bool _States_Is_suspended (
 }
 
 /**
- * This function returns true if the DELAYING state is set in
- * the_states, and false otherwise.
- *
- * @param[in] the_states is the task state set to test
- *
- * @return This method returns true if the desired state condition is set.
- */
-RTEMS_INLINE_ROUTINE bool _States_Is_delaying (
-  States_Control the_states
-)
-{
-   return (the_states & STATES_DELAYING);
-}
-
-/**
  * This function returns true if the WAITING_FOR_SEGMENT state is set in
  * the_states, and false otherwise.
  *
@@ -358,21 +342,6 @@ RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_semaphore (
  *
  * @return This method returns true if the desired state condition is set.
  */
-RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_time (
-  States_Control the_states
-)
-{
-   return (the_states & STATES_WAITING_FOR_TIME);
-}
-
-/**
- * This function returns true if the WAITING_FOR_TIME state is set in
- * the_states, and false otherwise.
- *
- * @param[in] the_states is the task state set to test
- *
- * @return This method returns true if the desired state condition is set.
- */
 RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_rpc_reply (
   States_Control the_states
 )




More information about the vc mailing list