[rtems commit] score: Add _Thread_Continue()

Sebastian Huber sebh at rtems.org
Tue Oct 24 08:22:28 UTC 2017


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Oct 19 13:41:25 2017 +0200

score: Add _Thread_Continue()

Update #3117.
Update #3182.

---

 cpukit/score/include/rtems/score/threadimpl.h | 18 ++++++++++++++++--
 cpukit/score/src/threadtimeout.c              | 25 +++++++++++++++++--------
 2 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index 8c87f98..5f6a5eb 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -1841,11 +1841,25 @@ RTEMS_INLINE_ROUTINE Status_Control _Thread_Wait_get_status(
 }
 
 /**
+ * @brief Cancels a blocking operation so that the thread can continue its
+ * execution.
+ *
+ * In case this function actually cancelled the blocking operation, then the
+ * thread wait return code is set to the specified status.
+ *
+ * A specialization of this function is _Thread_Timeout().
+ *
+ * @param[in] the_thread The thread.
+ * @param[in] status The thread wait status.
+ */
+void _Thread_Continue( Thread_Control *the_thread, Status_Control status );
+
+/**
  * @brief General purpose thread wait timeout.
  *
- * @param[in] watchdog The thread timer watchdog.
+ * @param[in] the_watchdog The thread timer watchdog.
  */
-void _Thread_Timeout( Watchdog_Control *watchdog );
+void _Thread_Timeout( Watchdog_Control *the_watchdog );
 
 RTEMS_INLINE_ROUTINE void _Thread_Timer_initialize(
   Thread_Timer_information *timer,
diff --git a/cpukit/score/src/threadtimeout.c b/cpukit/score/src/threadtimeout.c
index 8bcdc38..8ea5a65 100644
--- a/cpukit/score/src/threadtimeout.c
+++ b/cpukit/score/src/threadtimeout.c
@@ -22,14 +22,11 @@
 #include <rtems/score/threadimpl.h>
 #include <rtems/score/status.h>
 
-void _Thread_Timeout( Watchdog_Control *watchdog )
+void _Thread_Continue( Thread_Control *the_thread, Status_Control status )
 {
-  Thread_Control       *the_thread;
-  Thread_queue_Context  queue_context;
-  Thread_Wait_flags     wait_flags;
-  bool                  unblock;
-
-  the_thread = RTEMS_CONTAINER_OF( watchdog, Thread_Control, Timer.Watchdog );
+  Thread_queue_Context queue_context;
+  Thread_Wait_flags    wait_flags;
+  bool                 unblock;
 
   _Thread_queue_Context_initialize( &queue_context );
   _Thread_queue_Context_clear_priority_updates( &queue_context );
@@ -44,7 +41,7 @@ void _Thread_Timeout( Watchdog_Control *watchdog )
 
     _Thread_Wait_cancel( the_thread, &queue_context );
 
-    the_thread->Wait.return_code = STATUS_TIMEOUT;
+    the_thread->Wait.return_code = status;
 
     wait_class = wait_flags & THREAD_WAIT_CLASS_MASK;
     ready_again = wait_class | THREAD_WAIT_STATE_READY_AGAIN;
@@ -82,3 +79,15 @@ void _Thread_Timeout( Watchdog_Control *watchdog )
 #endif
   }
 }
+
+void _Thread_Timeout( Watchdog_Control *the_watchdog )
+{
+  Thread_Control *the_thread;
+
+  the_thread = RTEMS_CONTAINER_OF(
+    the_watchdog,
+    Thread_Control,
+    Timer.Watchdog
+  );
+  _Thread_Continue( the_thread, STATUS_TIMEOUT );
+}




More information about the vc mailing list