From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33293) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7Lww-0001GV-8j for qemu-devel@nongnu.org; Tue, 23 Jun 2015 07:01:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7Lws-0004Au-5a for qemu-devel@nongnu.org; Tue, 23 Jun 2015 07:01:06 -0400 Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:35852) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7LjL-0006jn-AU for qemu-devel@nongnu.org; Tue, 23 Jun 2015 06:47:03 -0400 Received: by wicnd19 with SMTP id nd19so102055730wic.1 for ; Tue, 23 Jun 2015 03:47:02 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <55893923.9010304@redhat.com> Date: Tue, 23 Jun 2015 12:46:59 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1435010055-4584-1-git-send-email-zavadovsky.yan@gmail.com> <5588F689.8050202@weilnetz.de> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] thread-win32: fix GetThreadContext() permanently fails List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , =?UTF-8?B?0K/QvSDQl9Cw0LLQsA==?= =?UTF-8?B?0LTQvtCy0YHQutC40Lk=?= Cc: Olivier Hainque , Stefan Weil , QEMU Developers , Fabien Chouteau On 23/06/2015 12:30, Peter Maydell wrote: > On 23 June 2015 at 10:55, Ян Завадовский wrote: >> On Tue, Jun 23, 2015 at 9:02 AM, Stefan Weil wrote: >>> We should add an URL to reliable documentation which supports that >>> claim. >> >> Unfortunately, MSDN says only "SuspendThread suspends the thread. It's >> designed for debuggers. Don't use in applications.": >> https://msdn.microsoft.com/en-us/library/windows/desktop/ms686345(v=vs.85).aspx >> And nothing more useful. >> So when I found this piece of code with Suspend/Resume and failed GetContext >> I did some googling. >> And found this article: >> http://blogs.msdn.com/b/oldnewthing/archive/2015/02/05/10591215.aspx > > Personally I am happy to treat a Raymond Chen blog post as "reliable > documentation"... Me too. :) SuspendThread was pretty much the only way to emulate signals. Initially I used SetThreadContext to redirect execution to cpu_signal; that was more complicated, but in retrospect it would have avoided the problems with memory barriers and with asynchronous SuspendThread. It certainly would have saved the AdaCore people a lot of debugging time. :( For 2.5, however, I wonder if SuspendThread/ResumeThread is needed at all now that cpu_exit doesn't have to undo block chaining anymore. Even on POSIX platforms the signal might not be necessary anymore. Paolo