From 6c44af8179f71a4355659008e1a58c793171e17d Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 22 Jan 2019 15:46:17 +0100 Subject: [PATCH] Cygwin: timerfd: Add support for CLOCK_REALTIME_ALARM/CLOCK_BOOTTIME_ALARM Signed-off-by: Corinna Vinschen --- 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 80d0c6fba..ba911ee54 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 87074fd6f..dc404883e 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 2c4b3e43f..a1799d08b 100644 --- a/winsup/doc/new-features.xml +++ b/winsup/doc/new-features.xml @@ -10,7 +10,8 @@ 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.