Intermittent failures retrieving process exit codes

Christopher Faylor cgf-use-the-mailinglist-please@cygwin.com
Fri Nov 15 19:21:00 GMT 2013


On Fri, Nov 15, 2013 at 07:53:26PM +0100, Denis Excoffier wrote:
>On 2013-11-14 05:01, Tom Honermann wrote:
>> On 12/21/2012 01:30 AM, Tom Honermann wrote:
>>> 
>>> The workaround I implemented within Cygwin was simple and sloppy.  I
>>> added a call to Sleep(1000) immediately before the call to ExitThread()
>>> in wait_sig() in winsup/cygwin/sigproc.cc.  Since this thread (probably)
>>> doesn't exit until the process is exiting anyway, the call to Sleep()
>>> does not adversely affect shutdown.  The thread just gets terminated
>>> while in the call to Sleep() instead of exiting before the process is
>>> terminated or getting terminated while still in the call to
>>> ExitThread().  A better solution might be to avoid the thread exiting at
>>> all (so long as it can't get terminated while holding critical
>>> resources), or to have the process exiting thread wait on it.  Neither
>>> of these is ideal.  Orderly shutdown of multi-threaded processes is
>>> really hard to do correctly on Windows.
>
>I experience on Windows 7 (not on XP) some problems that may be related.
>I would like to test your workaround, but sigproc.cc has much changed since
>then, there is now an exit_thead function with the comment "Exit the current
>thread very carefully.". I tried to insert Sleep(1000) at the end of
>exit_thread, immediately before "ExitThread (0)", but this yielded no
>change at all.
>
>Could someone be kind enough to update the workaround for modern sigproc.cc?

You apparently are misunderstanding the whole point of the changes to
sigproc.cc.  They were to work around this very problem.

cgf

--
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



More information about the Cygwin mailing list