This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygwin-2 process handling


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_tty.cc (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
occurs.

I had not noticed that, 

https://msdn.microsoft.com/en-us/library/windows/desktop/aa365779(v=vs.85).aspx

says:
> 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.
http://cygwin.com/ml/cygwin/2015-03/msg00221.html


ChageLog is as follows.

2015-05-21  Takashi Yano  <takashi.yano@nifty.ne.jp>

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

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

Attachment: cygwin.patch.20150521
Description: Binary data

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]