diff options
author | Christopher Faylor <me@cgf.cx> | 2005-11-04 20:45:56 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2005-11-04 20:45:56 +0000 |
commit | 72319550c16dee661534dd3002de2101b6a08dd7 (patch) | |
tree | e25a597b0bb5379578ed9fc885fbd5ebe329b898 /winsup/cygwin/times.cc | |
parent | f359a29fc84fdb1eca5b46f0a274e6fc8bdbc2ee (diff) | |
download | cygnal-72319550c16dee661534dd3002de2101b6a08dd7.tar.gz cygnal-72319550c16dee661534dd3002de2101b6a08dd7.tar.bz2 cygnal-72319550c16dee661534dd3002de2101b6a08dd7.zip |
* cygheap.h (init_cygheap::_gtod): New hires_ms element.
* hires.h (hires_ms::minperiod): Remove static designation.
(hires::began_period): New field.
* signal.cc: Include headers required for cygheap.h now that gtod lives in the
cygheap.
* timer.c: Ditto.
* times.cc (gtod): Delete variable.
(gtod::minperiod): Ditto.
(gtod::began_period): Define.
(hires_ms::prime): Add more debugging output. Call timeBeginPeriod only when
!began_period.
Diffstat (limited to 'winsup/cygwin/times.cc')
-rw-r--r-- | winsup/cygwin/times.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index 541f2bca6..22bd79684 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -144,8 +144,7 @@ totimeval (struct timeval *dst, FILETIME *src, int sub, int flag) dst->tv_sec = x / (long long) (1e6); } -hires_ms gtod; -UINT NO_COPY hires_ms::minperiod; /* minperiod needs to be NO_COPY since it +bool NO_COPY hires_ms::began_period; /* minperiod needs to be NO_COPY since it is a trigger for setting timeBeginPeriod which needs to be set once for every program. */ @@ -633,18 +632,25 @@ hires_ms::prime () TIMECAPS tc; FILETIME f; -stupid_printf ("entering, minperiod %d", minperiod); +stupid_printf ("entering, minperiod %d, began_period %d", minperiod, began_period); if (minperiod) /* done previously */; else if (timeGetDevCaps (&tc, sizeof (tc)) != TIMERR_NOERROR) +{stupid_printf ("timeGetDevCaps failed, %E"); minperiod = 1; +} else +{ + minperiod = min (max (tc.wPeriodMin, 1), tc.wPeriodMax); +stupid_printf ("timeGetDevCaps succeeded. tc.wPeriodMin %u, tc.wPeriodMax %u, minperiod %u", tc.wPeriodMin, tc.wPeriodMax, minperiod); } +stupid_printf ("inited %d, minperiod %u, began_period %d", minperiod, began_period); + + if (!began_period) { - minperiod = min (max (tc.wPeriodMin, 1), tc.wPeriodMax); -stupid_printf ("timeGetDevCaps succeeded. tc.wPeriodMin %u, tc.wPeriodMax %u, minperiod %u", tc.wPeriodMin, tc.wPeriodMax, minperiod); timeBeginPeriod (minperiod); + began_period = true; +stupid_printf ("timeBeginPeriod called"); } -stupid_printf ("inited %d"); if (!inited) { |