[PATCH 03/16] score: Add _Thread_Add_timeout_ticks()

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Oct 23 13:53:34 UTC 2017


Replace _Thread_Timer_insert_monotonic() with
_Thread_Add_timeout_ticks().

Update #3117.
Update #3182.
---
 cpukit/rtems/src/eventseize.c                 |  7 +------
 cpukit/rtems/src/taskwakeafter.c              |  7 +------
 cpukit/score/include/rtems/score/threadimpl.h | 11 +++++------
 cpukit/score/src/threadqenqueue.c             |  3 +--
 4 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/cpukit/rtems/src/eventseize.c b/cpukit/rtems/src/eventseize.c
index 76f9356800..c6bd4187bd 100644
--- a/cpukit/rtems/src/eventseize.c
+++ b/cpukit/rtems/src/eventseize.c
@@ -81,12 +81,7 @@ rtems_status_code _Event_Seize(
   _Thread_Wait_release_default( executing, lock_context );
 
   if ( ticks ) {
-    _Thread_Timer_insert_monotonic(
-      executing,
-      cpu_self,
-      _Thread_Timeout,
-      ticks
-    );
+    _Thread_Add_timeout_ticks( executing, cpu_self, ticks );
   }
 
   _Thread_Set_state( executing, block_state );
diff --git a/cpukit/rtems/src/taskwakeafter.c b/cpukit/rtems/src/taskwakeafter.c
index 43bf612f61..cf118dcf16 100644
--- a/cpukit/rtems/src/taskwakeafter.c
+++ b/cpukit/rtems/src/taskwakeafter.c
@@ -41,12 +41,7 @@ rtems_status_code rtems_task_wake_after(
     } else {
       _Thread_Set_state( executing, STATES_WAITING_FOR_TIME );
       _Thread_Wait_flags_set( executing, THREAD_WAIT_STATE_BLOCKED );
-      _Thread_Timer_insert_monotonic(
-        executing,
-        cpu_self,
-        _Thread_Timeout,
-        ticks
-      );
+      _Thread_Add_timeout_ticks( executing, cpu_self, ticks );
     }
   _Thread_Dispatch_direct( cpu_self );
   return RTEMS_SUCCESSFUL;
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index 6e4c461096..8c87f98cb8 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -1857,11 +1857,10 @@ RTEMS_INLINE_ROUTINE void _Thread_Timer_initialize(
   _Watchdog_Preinitialize( &timer->Watchdog, cpu );
 }
 
-RTEMS_INLINE_ROUTINE void _Thread_Timer_insert_monotonic(
-  Thread_Control                 *the_thread,
-  Per_CPU_Control                *cpu,
-  Watchdog_Service_routine_entry  routine,
-  Watchdog_Interval               ticks
+RTEMS_INLINE_ROUTINE void _Thread_Add_timeout_ticks(
+  Thread_Control    *the_thread,
+  Per_CPU_Control   *cpu,
+  Watchdog_Interval  ticks
 )
 {
   ISR_lock_Context lock_context;
@@ -1870,7 +1869,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Timer_insert_monotonic(
 
   the_thread->Timer.header =
     &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ];
-  the_thread->Timer.Watchdog.routine = routine;
+  the_thread->Timer.Watchdog.routine = _Thread_Timeout;
   _Watchdog_Per_CPU_insert_ticks( &the_thread->Timer.Watchdog, cpu, ticks );
 
   _ISR_lock_Release_and_ISR_enable( &the_thread->Timer.Lock, &lock_context );
diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c
index df1bea02cb..41cd1e62ad 100644
--- a/cpukit/score/src/threadqenqueue.c
+++ b/cpukit/score/src/threadqenqueue.c
@@ -385,10 +385,9 @@ static void _Thread_queue_Timeout(
     case WATCHDOG_RELATIVE:
       /* A relative timeout of 0 is a special case indefinite (no) timeout */
       if ( queue_context->timeout != 0 ) {
-        _Thread_Timer_insert_monotonic(
+        _Thread_Add_timeout_ticks(
           the_thread,
           cpu_self,
-          _Thread_Timeout,
           (Watchdog_Interval) queue_context->timeout
         );
       }
-- 
2.12.3




More information about the devel mailing list