MinTTY requires gdiplus.dll ? (2)
Houder
houder@xs4all.nl
Sat Dec 1 08:57:00 GMT 2018
On 2018-11-30 14:19, Corinna Vinschen wrote:
[snip]
> I'm trying to avoid remote debugging so I rather try to reproduce this
> @work. However, if you're interested in debugging this, set a
> breakpoint to clk_monotonic_t::now() and observe how the call to the
> virtual init() method hangs or crashes. If you find out why, I'd be
> most grateful.
Below I included parts of the diff between 1126 and 1129. You have been
refactoring the code related to "timing".
Above you state that the call to init() (clk_monotonic_t::init(), is my
understanding) from clk_monotonic_t::now() makes the cygwin1.dll end up
in "some mysterious loop" (my wording). At least on pre-W10 ...
Looking at the code (trying to understand it), it appears to me that it
is NOT "Windows version" dependent ...
My question: why do you claim in
https://cygwin.com/ml/cygwin/2018-11/msg00261.html
that Windows 10 is NOT affected? Does W10 run a different "thread" in
the Cygwin codebase?
Regards,
Henri
======
https://cygwin.com/snapshots/x86/cygwin-diffs-20181126-20181129
FILE: winsup/cygwin/clock.h:
+class clk_t
+{
+ protected:
+ LONG inited;
+ LONGLONG ticks_per_sec;
+ virtual void init ();
+ virtual int now (clockid_t, struct timespec *) = 0
...
+class clk_monotonic_t : public clk_t
+{
+ protected:
+ virtual void init ();
+ private:
+ virtual int now (clockid_t, struct timespec *);
+};
...
FILE: winsup/cygwin/clock.cc:
+void
+clk_t::init ()
+{
+ spinlock spin (inited, 1);
+ if (!spin)
+ ticks_per_sec = system_tickcount_resolution ();
+}
+
...
+void
+clk_monotonic_t::init ()
+{
+ spinlock spin (inited, 1);
+ if (!spin)
+ ticks_per_sec = system_qpc_resolution ();
+}
...
+int
+clk_monotonic_t::now (clockid_t clockid, struct timespec *ts)
+{
+ if (wincap.has_precise_interrupt_time ())
+ {
+ /* Suspend time not taken into account, as on Linux */
+ ULONGLONG now;
+
+ QueryUnbiasedInterruptTimePrecise (&now);
+ ts->tv_sec = now / NS100PERSEC;
+ now %= NS100PERSEC;
+ ts->tv_nsec = now * (NSPERSEC/NS100PERSEC);
+ }
+ else
+ {
+ /* https://stackoverflow.com/questions/24330496. Skip rounding
since
+ its almost always wrong when working with timestamps */
+ UINT64 bias;
+ LARGE_INTEGER now;
+ struct timespec bts;
+
+ if (inited <= 0)
+ init (); // Henri: invocation of
clk_monotonic_t::init()
+ do
+ {
+ bias = SharedUserData.InterruptTimeBias;
+ QueryPerformanceCounter(&now);
+ }
+ while (bias != SharedUserData.InterruptTimeBias);
+ /* Convert perf counter to timespec */
+ ts->tv_sec = now.QuadPart / ticks_per_sec;
+ now.QuadPart %= ticks_per_sec;
+ ts->tv_nsec = (now.QuadPart * NSPERSEC) / ticks_per_sec;
+ /* Convert bias to timespec */
+ bts.tv_sec = bias / NS100PERSEC;
+ bias %= NS100PERSEC;
+ bts.tv_nsec = bias * (NSPERSEC/NS100PERSEC);
+ /* Subtract bias from perf */
+ ts_diff (bts, *ts);
+ }
+ return 0;
+}
=====
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list