summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/ratemontimeout.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-01-24 14:37:42 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-01-24 14:44:37 +0100
commit1240aade5a35c4e8c43d5409e2329eeb6a173299 (patch)
treee448ee77dda407cc8c04ccddaf3cb982f7d3e569 /cpukit/rtems/src/ratemontimeout.c
parentfsscandir01: Check MAXNAMLEN and NAME_MAX (diff)
downloadrtems-1240aade5a35c4e8c43d5409e2329eeb6a173299.tar.bz2
rtems: Fix _Rate_monotonic_Renew_deadline()
Make _Rate_monotonic_Renew_deadline() static and use proper locking in SMP configurations. Update #2795.
Diffstat (limited to 'cpukit/rtems/src/ratemontimeout.c')
-rw-r--r--cpukit/rtems/src/ratemontimeout.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/cpukit/rtems/src/ratemontimeout.c b/cpukit/rtems/src/ratemontimeout.c
index c2a0291fd8..bcc4ccfbf8 100644
--- a/cpukit/rtems/src/ratemontimeout.c
+++ b/cpukit/rtems/src/ratemontimeout.c
@@ -22,6 +22,27 @@
#include <rtems/rtems/ratemonimpl.h>
+static void _Rate_monotonic_Renew_deadline(
+ Rate_monotonic_Control *the_period,
+ Thread_Control *owner,
+ ISR_lock_Context *lock_context
+)
+{
+ uint64_t deadline;
+
+ ++the_period->postponed_jobs;
+ the_period->state = RATE_MONOTONIC_EXPIRED;
+
+ deadline = _Watchdog_Per_CPU_insert_relative(
+ &the_period->Timer,
+ _Per_CPU_Get(),
+ the_period->next_length
+ );
+ the_period->latest_deadline = deadline;
+
+ _Rate_monotonic_Release( the_period, lock_context );
+}
+
void _Rate_monotonic_Timeout( Watchdog_Control *the_watchdog )
{
Rate_monotonic_Control *the_period;
@@ -64,14 +85,6 @@ void _Rate_monotonic_Timeout( Watchdog_Control *the_watchdog )
_Thread_Unblock( owner );
}
} else {
- /*
- * If the watchdog is timeout, it means there is an additional postponed
- * job in the next period but it is not available to release now:
- * Either the current task is still executed, or it is preemptive by the
- * other higher priority tasks.
- */
- the_period->postponed_jobs += 1;
- the_period->state = RATE_MONOTONIC_EXPIRED;
_Rate_monotonic_Renew_deadline( the_period, owner, &lock_context );
}
}