Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-11-04 20:38:32 +0300
committerChristopher Faylor <me@cgf.cx>2005-11-04 20:38:32 +0300
commitf359a29fc84fdb1eca5b46f0a274e6fc8bdbc2ee (patch)
tree5e56d33df802f867ab3001caeb0e3c18c326908b
parent39dd399c50ee4b20e6d733300d0b0939efe5f204 (diff)
* times.cc (hires_ms::prime): More debugging.
(hires_ms::usecs): Ditto.
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/fork.cc2
-rw-r--r--winsup/cygwin/times.cc32
3 files changed, 27 insertions, 12 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index a02717db8..42c9f95e4 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2005-11-04 Christopher Faylor <cgf@timesys.com>
+
+ * times.cc (hires_ms::prime): More debugging.
+ (hires_ms::usecs): Ditto.
+
2005-11-03 Christopher Faylor <cgf@timesys.com>
* times.cc (stupid_printf): Define and use throughout -- temporarily.
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
index 31d2a10b5..33811eccd 100644
--- a/winsup/cygwin/fork.cc
+++ b/winsup/cygwin/fork.cc
@@ -240,8 +240,8 @@ frok::child (void *)
cygbench ("fork-child");
ld_preload ();
fixup_hooks_after_fork ();
- cygwin_finished_initializing = true;
_my_tls.fixup_after_fork ();
+ cygwin_finished_initializing = true;
return 0;
}
diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc
index aa1a34d85..541f2bca6 100644
--- a/winsup/cygwin/times.cc
+++ b/winsup/cygwin/times.cc
@@ -144,8 +144,11 @@ totimeval (struct timeval *dst, FILETIME *src, int sub, int flag)
dst->tv_sec = x / (long long) (1e6);
}
-hires_ms NO_COPY gtod;
-UINT hires_ms::minperiod;
+hires_ms gtod;
+UINT NO_COPY hires_ms::minperiod; /* minperiod needs to be NO_COPY since it
+ is a trigger for setting timeBeginPeriod
+ which needs to be set once for every
+ program. */
/* FIXME: Make thread safe */
extern "C" int
@@ -631,15 +634,16 @@ hires_ms::prime ()
FILETIME f;
stupid_printf ("entering, minperiod %d", minperiod);
- if (!minperiod)
- if (timeGetDevCaps (&tc, sizeof (tc)) != TIMERR_NOERROR)
- minperiod = 1;
- else
- {
-stupid_printf ("timeGetDevCaps succeeded");
- minperiod = min (max (tc.wPeriodMin, 1), tc.wPeriodMax);
- timeBeginPeriod (minperiod);
- }
+ if (minperiod)
+ /* done previously */;
+ else if (timeGetDevCaps (&tc, sizeof (tc)) != TIMERR_NOERROR)
+ 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);
+ timeBeginPeriod (minperiod);
+ }
stupid_printf ("inited %d");
if (!inited)
@@ -668,17 +672,23 @@ stupid_printf ("returning");
LONGLONG
hires_ms::usecs (bool justdelta)
{
+stupid_printf ("before call to prime(), minperiod %u, process priority %d", minperiod, GetThreadPriority (GetCurrentThread ()));
if (!minperiod) /* NO_COPY variable */
prime ();
+stupid_printf ("after call to prime(), process priority %d", GetThreadPriority (GetCurrentThread ()));
+
DWORD now = timeGetTime ();
+stupid_printf ("after call to timeGetTime, process priority %d", GetThreadPriority (GetCurrentThread ()));
if ((int) (now - initime_ms) < 0)
{
+stupid_printf ("special casing, process priority %d", GetThreadPriority (GetCurrentThread ()));
inited = 0;
prime ();
now = timeGetTime ();
}
// FIXME: Not sure how this will handle the 49.71 day wrap around
LONGLONG res = initime_us.QuadPart + ((LONGLONG) (now - initime_ms) * 1000);
+stupid_printf ("res %U, process priority %d", res, GetThreadPriority (GetCurrentThread ()));
return res;
}