summaryrefslogtreecommitdiff
path: root/gcc/ada/s-taprop-posix.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2013-10-10 14:30:10 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2013-10-10 14:30:10 +0200
commit58747e480855841d1d510af687f7292c95151d17 (patch)
tree663e8bb2e76b347fa1c551e019012f3479123e11 /gcc/ada/s-taprop-posix.adb
parent4530b919823b0cd7cdaddd14350310e2cb5711c4 (diff)
downloadgcc-58747e480855841d1d510af687f7292c95151d17.tar.gz
[multiple changes]
2013-10-10 Thomas Quinot <quinot@adacore.com> * s-oscons-tmplt.c, s-taprop-posix.adb (CLOCK_REALTIME): Always define, possibly using a dummy placeholder value. (Compute_Deadline): For the case of an Absolute_Calendar deadline, if the target uses another clock than CLOCK_REALTIME as CLOCK_RT_Ada, compensate for possible different epoch. 2013-10-10 Ed Schonberg <schonberg@adacore.com> * sem_ch8.adb (Find_Expanded_Name): Handle properly a fully qualified reference to a generic child unit within itself, in an instantiation. From-SVN: r203363
Diffstat (limited to 'gcc/ada/s-taprop-posix.adb')
-rw-r--r--gcc/ada/s-taprop-posix.adb32
1 files changed, 31 insertions, 1 deletions
diff --git a/gcc/ada/s-taprop-posix.adb b/gcc/ada/s-taprop-posix.adb
index 275828d049c..cf45eb4b6db 100644
--- a/gcc/ada/s-taprop-posix.adb
+++ b/gcc/ada/s-taprop-posix.adb
@@ -262,6 +262,8 @@ package body System.Task_Primitives.Operations is
begin
Check_Time := Monotonic_Clock;
+ -- Relative deadline
+
if Mode = Relative then
Abs_Time := Duration'Min (Time, Max_Sensible_Delay) + Check_Time;
@@ -269,12 +271,40 @@ package body System.Task_Primitives.Operations is
Rel_Time := Duration'Min (Max_Sensible_Delay, Time);
end if;
- else
+ pragma Warnings (Off);
+ -- Must comment a pragma Warnings (Off) to say why ???
+
+ -- Absolute deadline specified using the tasking clock (CLOCK_RT_Ada)
+
+ elsif Mode = Absolute_RT
+ or else OSC.CLOCK_RT_Ada = OSC.CLOCK_REALTIME
+ then
+ pragma Warnings (On);
Abs_Time := Duration'Min (Check_Time + Max_Sensible_Delay, Time);
if Relative_Timed_Wait then
Rel_Time := Duration'Min (Max_Sensible_Delay, Time - Check_Time);
end if;
+
+ -- Absolute deadline specified using the real-time clock, in the
+ -- case where it is not the same as the tasking clock: compensate for
+ -- difference between clock epochs (Base_Time - Base_Cal_Time).
+
+ else
+ declare
+ Cal_Check_Time : constant Duration :=
+ OS_Primitives.Monotonic_Clock;
+ RT_Time : constant Duration :=
+ Time + Check_Time - Cal_Check_Time;
+ begin
+ Abs_Time :=
+ Duration'Min (Check_Time + Max_Sensible_Delay, RT_Time);
+
+ if Relative_Timed_Wait then
+ Rel_Time :=
+ Duration'Min (Max_Sensible_Delay, RT_Time - Check_Time);
+ end if;
+ end;
end if;
end Compute_Deadline;