[PATCH v2] Cygwin: pty: Revise code waiting for forwarding by master_fwd_thread.
Wed Jan 22 16:00:00 GMT 2020
On Tue, 21 Jan 2020 10:37:35 +0100
Corinna Vinschen wrote:
> On Jan 21 11:22, Takashi Yano wrote:
> > - Though this rarely happens, sometimes the first printing of non-
> > cygwin process does not displayed correctly. To fix this issue,
> > the code for waiting for forwarding by master_fwd_thread is revised.
> Looks good. Pushed.
First of all, I have to apologize for insufficient test.
With this patch, the following test case frequently displays
its output incorrectly.
Sometimes it is just
Of course, the expected ersult is:
/* Test code */
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "BBBB\r\n", 6, &n, 0);
I looked into this problem and found that the cause. What we
really need is not waiting for forwarding by pty_master_fwd_thread
but is waiting for forwarding by pseudo console itself. In other
words, the latency between slave write to get_output_handle()
and master read from from_slave pipe is dominant.
We cannot touch the forwarding process in pseudo console, therefore
the strategy like this patch can not be used. So, we might have to
revert to dumb Sleep() wait.
As for the wait time, I have measured the latency of pseudo console
in following machines.
Machine1: Ryzen 9 3950X (3.5GHz)
Machine2: Core i7 6700K (4.0GHz)
Machine3: Xeon X5670 (2.93GHz)
Machine4: Core i7 870 (2.93GHz)
Machine5: PentinumD 930 (3.0GHz) <- Very old!
Measuring is done 1000 times for each machine. The results are as
Obviously, the latency depends on the machine performance.
Therefore, I will propose new patch which uses dumb Sleep()
with on-the-fly performance test.
Takashi Yano <firstname.lastname@example.org>
More information about the Cygwin-patches