Cygwin: pty: Use GetTickCount64() instead of GetTickCount().

Suggested-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
This commit is contained in:
Takashi Yano 2022-12-09 10:12:02 +09:00
parent be635ebc2f
commit faac79783c
3 changed files with 7 additions and 7 deletions

View File

@ -2691,7 +2691,7 @@ fhandler_pty_master::pty_master_fwd_thread (const master_fwd_thread_param_t *p)
termios_printf ("Started."); termios_printf ("Started.");
for (;;) for (;;)
{ {
p->ttyp->fwd_last_time = GetTickCount (); p->ttyp->fwd_last_time = GetTickCount64 ();
DWORD n; DWORD n;
p->ttyp->fwd_not_empty = p->ttyp->fwd_not_empty =
::bytes_available (n, p->from_slave_nat) && n; ::bytes_available (n, p->from_slave_nat) && n;

View File

@ -119,7 +119,7 @@ private:
bool switch_to_nat_pipe; bool switch_to_nat_pipe;
DWORD nat_pipe_owner_pid; DWORD nat_pipe_owner_pid;
UINT term_code_page; UINT term_code_page;
DWORD fwd_last_time; ULONGLONG fwd_last_time;
bool fwd_not_empty; bool fwd_not_empty;
HANDLE h_pcon_write_pipe; HANDLE h_pcon_write_pipe;
HANDLE h_pcon_condrv_reference; HANDLE h_pcon_condrv_reference;

View File

@ -319,13 +319,13 @@ tty::wait_fwd ()
16-32 msec even if it already has data to transfer. 16-32 msec even if it already has data to transfer.
If the time without transfer exceeds 32 msec, the If the time without transfer exceeds 32 msec, the
forwarding is supposed to be finished. fwd_last_time 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. */ thread when the last data is transfered. */
const int sleep_in_nat_pipe = 16; const ULONGLONG sleep_in_nat_pipe = 16;
const int time_to_wait = sleep_in_nat_pipe * 2 + 1/* margine */; const ULONGLONG time_to_wait = sleep_in_nat_pipe * 2 + 1/* margine */;
int elapsed; ULONGLONG elapsed;
while (fwd_not_empty 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); int tw = fwd_not_empty ? 10 : (time_to_wait - elapsed);
cygwait (tw); cygwait (tw);