public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Takashi Yano <tyan0@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: pty: Use GetTickCount64() instead of GetTickCount().
Date: Fri,  9 Dec 2022 12:01:58 +0000 (GMT)	[thread overview]
Message-ID: <20221209120158.5B74B3881D2F@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=faac79783c27c030ab17a6f298f8aa89c51a03c5

commit faac79783c27c030ab17a6f298f8aa89c51a03c5
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Fri Dec 9 10:12:02 2022 +0900

    Cygwin: pty: Use GetTickCount64() instead of GetTickCount().
    
    Suggested-by: Corinna Vinschen <corinna@vinschen.de>
    Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>

Diff:
---
 winsup/cygwin/fhandler/pty.cc      |  2 +-
 winsup/cygwin/local_includes/tty.h |  2 +-
 winsup/cygwin/tty.cc               | 10 +++++-----
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc
index e7106daba..c9b05e3d7 100644
--- a/winsup/cygwin/fhandler/pty.cc
+++ b/winsup/cygwin/fhandler/pty.cc
@@ -2691,7 +2691,7 @@ fhandler_pty_master::pty_master_fwd_thread (const master_fwd_thread_param_t *p)
   termios_printf ("Started.");
   for (;;)
     {
-      p->ttyp->fwd_last_time = GetTickCount ();
+      p->ttyp->fwd_last_time = GetTickCount64 ();
       DWORD n;
       p->ttyp->fwd_not_empty =
 	::bytes_available (n, p->from_slave_nat) && n;
diff --git a/winsup/cygwin/local_includes/tty.h b/winsup/cygwin/local_includes/tty.h
index 3d0ea0c68..cd1d6ecaa 100644
--- a/winsup/cygwin/local_includes/tty.h
+++ b/winsup/cygwin/local_includes/tty.h
@@ -119,7 +119,7 @@ private:
   bool switch_to_nat_pipe;
   DWORD nat_pipe_owner_pid;
   UINT term_code_page;
-  DWORD fwd_last_time;
+  ULONGLONG fwd_last_time;
   bool fwd_not_empty;
   HANDLE h_pcon_write_pipe;
   HANDLE h_pcon_condrv_reference;
diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc
index a862a444e..6ec8927cb 100644
--- a/winsup/cygwin/tty.cc
+++ b/winsup/cygwin/tty.cc
@@ -319,13 +319,13 @@ tty::wait_fwd ()
      16-32 msec even if it already has data to transfer.
      If the time without transfer exceeds 32 msec, the
      forwarding is supposed to be finished. fwd_last_time
-     is reset to GetTickCount() in pty master forwarding
+     is reset to GetTickCount64() in pty master forwarding
      thread when the last data is transfered. */
-  const int sleep_in_nat_pipe = 16;
-  const int time_to_wait = sleep_in_nat_pipe * 2 + 1/* margine */;
-  int elapsed;
+  const ULONGLONG sleep_in_nat_pipe = 16;
+  const ULONGLONG time_to_wait = sleep_in_nat_pipe * 2 + 1/* margine */;
+  ULONGLONG elapsed;
   while (fwd_not_empty
-	 || (elapsed = GetTickCount () - fwd_last_time) < time_to_wait)
+	 || (elapsed = GetTickCount64 () - fwd_last_time) < time_to_wait)
     {
       int tw = fwd_not_empty ? 10 : (time_to_wait - elapsed);
       cygwait (tw);

                 reply	other threads:[~2022-12-09 12:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221209120158.5B74B3881D2F@sourceware.org \
    --to=tyan0@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).