cygwin-2 process handling

Takashi Yano
Thu May 21 12:13:00 GMT 2015

Hi Ken,

On Tue, 19 May 2015 14:16:35 -0400
Ken Brown wrote:

> OK, I got the bisection to work:
> 32fd5b0fe1548cff79b9868e4e259853c59a44db is the first bad commit
> commit 32fd5b0fe1548cff79b9868e4e259853c59a44db
> Author: Takashi Yano <xxx>
> Date:   Thu Mar 12 15:48:10 2015 +0100
>      Let pty slave detect closure of last master handle
>          * (fhandler_pty_master::close): Add code to 
> make slave
>          detect closure of master. Fix typo in error message.
> Takashi, can you help?  If not, we'll have to wait for Corinna to get 
> back from vacation.

I was looking into this problem, and found the PeekNamedPipe()
call is blocked in fhandler_pty_master::close() when the problem

I had not noticed that,

> The PeekNamedPipe function can block thread execution the same
> way any I/O function can when called on a synchronous handle in
> a multi-threaded application.

I have made a patch attached to resolve this problem. Please have
a look.

With this patch, NtQueryObject() is used instead of PeekNamedPipe()
to detect closure of the last master handle.

Please refer to the following discussion for more details.

ChageLog is as follows.

2015-05-21  Takashi Yano  <>

	* (fhandler_pty_master::close): Use NtQueryObject()
	instead of PeekNamedPipe() to detect closing the last master handle.

Takashi Yano <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygwin.patch.20150521
Type: application/octet-stream
Size: 1543 bytes
Desc: not available
URL: <>
-------------- next part --------------
Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list