Cygwin: pty: Revise code to make system_printf() work after close.

- After commit 0365031ce1, the issue
  https://cygwin.com/pipermail/cygwin-patches/2020q2/010259.html
  occurs. This patch fixes the issue.
This commit is contained in:
Takashi Yano via Cygwin-patches
2020-05-21 17:25:01 +09:00
committed by Corinna Vinschen
parent bf07202e16
commit c26e08095d
3 changed files with 37 additions and 3 deletions

View File

@ -294,3 +294,26 @@ tty_min::ttyname ()
d.parse (ntty);
return d.name ();
}
void
tty::set_switch_to_pcon_out (bool v)
{
if (switch_to_pcon_out != v)
{
wait_pcon_fwd ();
switch_to_pcon_out = v;
}
}
void
tty::wait_pcon_fwd (void)
{
const int sleep_in_pcon = 16;
const int time_to_wait = sleep_in_pcon * 2 + 1/* margine */;
pcon_last_time = GetTickCount ();
while (GetTickCount () - pcon_last_time < time_to_wait)
{
int tw = time_to_wait - (GetTickCount () - pcon_last_time);
cygwait (tw);
}
}