delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/12/01/03:57:31

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:content-type
:content-transfer-encoding:date:from:to:subject:in-reply-to
:references:message-id; q=dns; s=default; b=uxPvzqxr1K4NcJeIOIad
/IE2/MujV3BQNfgLB0GpqGzr8XI3+llwNQWMTPthjMx7qckjaFTIfjB1obJim/TH
fu/bBY/Ela1eHLgwLxePJ9SEnPgYy3oZV0+ujYwjiZ3wDYhLvRhy/YZ7kTB+lxgU
BsuJoGXxQPkhGE8yZWMionk=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:content-type
:content-transfer-encoding:date:from:to:subject:in-reply-to
:references:message-id; s=default; bh=tztb0MvUDHOBNtjyeddXkGg4al
k=; b=pAhEfe1zr3ily2v0n03qzz06C1yWwwW70KvdfHuaVVpE8BeAiLtuBABB3n
790v2yE7d+HBRQpvUVjFMp13c5e3YYEe8APZA7SAOngAUnFAitADdGQpYvNgnfYf
kB4yPhRxf1hy2VKcZ2sE8v8Zo/77rGieNzg5UknzsIpovZqnw=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=claim, Hx-spam-relays-external:sk:webmail, H*RU:sk:webmail, H*F:D*nl
X-HELO: lb1-smtp-cloud9.xs4all.net
MIME-Version: 1.0
Date: Sat, 01 Dec 2018 09:57:15 +0100
From: Houder <houder AT xs4all DOT nl>
To: cygwin AT cygwin DOT com
Subject: Re: MinTTY requires gdiplus.dll ? (2)
In-Reply-To: <20181130131918.GI30649@calimero.vinschen.de>
References: <1953c30851fd83b67ee9b162b29f4195 AT xs4all DOT nl> <20181129195845 DOT GE30649 AT calimero DOT vinschen DOT de> <4286450150901731f39f9514b8044ded AT xs4all DOT nl> <20181130131918 DOT GI30649 AT calimero DOT vinschen DOT de>
Message-ID: <fb45509f322f95b57ae075c05260383a@xs4all.nl>
X-Sender: houder AT xs4all DOT nl
User-Agent: XS4ALL Webmail
X-IsSubscribed: yes

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019