[newlib-cygwin] Cygwin: timerfd: Add support for CLOCK_REALTIME_ALARM/CLOCK_BOOTTIME_ALARM
Corinna Vinschen
corinna@sourceware.org
Tue Jan 22 14:47:00 GMT 2019
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=6c44af8179f71a4355659008e1a58c793171e17d
commit 6c44af8179f71a4355659008e1a58c793171e17d
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Tue Jan 22 15:46:17 2019 +0100
Cygwin: timerfd: Add support for CLOCK_REALTIME_ALARM/CLOCK_BOOTTIME_ALARM
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/release/2.12.0 | 3 ++-
winsup/cygwin/timerfd.cc | 11 +++++------
winsup/doc/new-features.xml | 3 ++-
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/winsup/cygwin/release/2.12.0 b/winsup/cygwin/release/2.12.0
index 80d0c6f..ba911ee 100644
--- a/winsup/cygwin/release/2.12.0
+++ b/winsup/cygwin/release/2.12.0
@@ -2,7 +2,8 @@ What's new:
-----------
- Support for CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE,
- CLOCK_MONOTONIC_RAW, CLOCK_BOOTTIME clocks.
+ CLOCK_MONOTONIC_RAW, CLOCK_BOOTTIME, CLOCK_REALTIME_ALARM,
+ CLOCK_BOOTTIME_ALARM clocks.
- Support for case sensitive directories. mkdir(2) automatically
creates directories within the Cygwin installation dir as case
diff --git a/winsup/cygwin/timerfd.cc b/winsup/cygwin/timerfd.cc
index 87074fd..dc40488 100644
--- a/winsup/cygwin/timerfd.cc
+++ b/winsup/cygwin/timerfd.cc
@@ -173,9 +173,8 @@ timerfd_tracker::thread_func ()
interval. Restart timer here with new due time. */
if (get_interval () > INT_MAX * (NS100PERSEC / MSPERSEC))
{
- /* TODO: CLOCK_REALTIME_ALARM / CLOCK_BOOTTIME_ALARM
- See comment in arm_timer */
- BOOL Resume = FALSE;
+ BOOLEAN Resume = (get_clockid () == CLOCK_REALTIME_ALARM
+ || get_clockid () == CLOCK_BOOTTIME_ALARM);
LARGE_INTEGER DueTime = { QuadPart: -get_interval () };
NtSetTimer (tfd_shared->timer (), &DueTime, NULL, NULL,
@@ -573,10 +572,10 @@ timerfd_shared::arm_timer (int flags, const struct itimerspec *new_value)
set_exp_ts (ts);
time_spec () = *new_value;
read_and_reset_expiration_count ();
- /* TODO: CLOCK_REALTIME_ALARM / CLOCK_BOOTTIME_ALARM
- Note: Advanced Power Settings -> Sleep -> Allow Wake Timers
+ /* Note: Advanced Power Settings -> Sleep -> Allow Wake Timers
since W10 1709 */
- Resume = FALSE;
+ Resume = (_clockid == CLOCK_REALTIME_ALARM
+ || _clockid == CLOCK_BOOTTIME_ALARM);
if (_interval > INT_MAX * (NS100PERSEC / MSPERSEC))
Period = 0;
else
diff --git a/winsup/doc/new-features.xml b/winsup/doc/new-features.xml
index 2c4b3e4..a1799d0 100644
--- a/winsup/doc/new-features.xml
+++ b/winsup/doc/new-features.xml
@@ -10,7 +10,8 @@
<listitem><para>
Support for CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE,
-CLOCK_MONOTONIC_RAW, CLOCK_BOOTTIME clocks.
+CLOCK_MONOTONIC_RAW, CLOCK_BOOTTIME, CLOCK_REALTIME_ALARM,
+CLOCK_BOOTTIME_ALARM clocks.
</para></listitem>
<listitem><para>
More information about the Cygwin-cvs
mailing list