From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 73018 invoked by alias); 26 Feb 2019 09:46:39 -0000 Mailing-List: contact cygwin-cvs-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-cvs-owner@cygwin.com Received: (qmail 73003 invoked by uid 9078); 26 Feb 2019 09:46:39 -0000 Date: Tue, 26 Feb 2019 09:46:00 -0000 Message-ID: <20190226094639.73002.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: timerfd: add a sleep when being debugged X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: 5a483b6bcac263102df890c3172ecddf23fc9f53 X-Git-Newrev: 639645a2fd753f29ed9693b7c34f015c01de1741 X-SW-Source: 2019-q1/txt/msg00196.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=639645a2fd753f29ed9693b7c34f015c01de1741 commit 639645a2fd753f29ed9693b7c34f015c01de1741 Author: Corinna Vinschen Date: Tue Feb 26 10:46:05 2019 +0100 Cygwin: timerfd: add a sleep when being debugged A sleep is required on Windows 10 64 bit only before calling RegisterClassW in the timerfd thread, and only when running under strace. One of the child processes inheriting the timerfd descriptor will get a STATUS_FLOAT_INEXACT_RESULT exception inside of msvcrt.dll. It's apparently some timing problem. It occurs in 4 out of 5 runs under strace only. WOW64 and Windows 7 64 bit don't have this problem. Signed-off-by: Corinna Vinschen Diff: --- winsup/cygwin/timerfd.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/winsup/cygwin/timerfd.cc b/winsup/cygwin/timerfd.cc index b0d4db9..8e4c94e 100644 --- a/winsup/cygwin/timerfd.cc +++ b/winsup/cygwin/timerfd.cc @@ -32,6 +32,15 @@ timerfd_tracker::create_timechange_window () wclass.lpfnWndProc = DefWindowProcW; wclass.hInstance = user_data->hmodule; wclass.lpszClassName = cname; + /* This sleep is required on Windows 10 64 bit only, and only when running + under strace. One of the child processes inheriting the timerfd + descriptor will get a STATUS_FLOAT_INEXACT_RESULT exception inside of + msvcrt.dll. While this is completely crazy in itself, it's apparently + some timing problem. It occurs in 4 out of 5 runs under strace only. + The sleep is required before calling RegisterClassW. Moving it before + CreateWindowExW does not work. What the heck? */ + if (being_debugged ()) + Sleep (1L); atom = RegisterClassW (&wclass); if (!atom) debug_printf ("RegisterClass %E");