From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38986) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7MDn-000621-BM for qemu-devel@nongnu.org; Tue, 23 Jun 2015 07:18:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7MDj-000331-NZ for qemu-devel@nongnu.org; Tue, 23 Jun 2015 07:18:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34473) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7MDj-00032v-IT for qemu-devel@nongnu.org; Tue, 23 Jun 2015 07:18:27 -0400 Date: Tue, 23 Jun 2015 12:18:22 +0100 From: "Daniel P. Berrange" Message-ID: <20150623111822.GE30318@redhat.com> References: <1435010055-4584-1-git-send-email-zavadovsky.yan@gmail.com> <5588F689.8050202@weilnetz.de> <55893923.9010304@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <55893923.9010304@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] thread-win32: fix GetThreadContext() permanently fails Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Olivier Hainque , Peter Maydell , =?utf-8?B?0K/QvSDQl9Cw0LLQsNC00L7QstGB0LrQuNC5?= , Stefan Weil , QEMU Developers , Fabien Chouteau On Tue, Jun 23, 2015 at 12:46:59PM +0200, Paolo Bonzini wrote: >=20 >=20 > On 23/06/2015 12:30, Peter Maydell wrote: > > On 23 June 2015 at 10:55, =D0=AF=D0=BD =D0=97=D0=B0=D0=B2=D0=B0=D0=B4= =D0=BE=D0=B2=D1=81=D0=BA=D0=B8=D0=B9 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=3D= vs.85).aspx > >> And nothing more useful. > >> So when I found this piece of code with Suspend/Resume and failed Ge= tContext > >> I did some googling. > >> And found this article: > >> http://blogs.msdn.com/b/oldnewthing/archive/2015/02/05/10591215.aspx > >=20 > > Personally I am happy to treat a Raymond Chen blog post as "reliable > > documentation"... >=20 > Me too. :) >=20 > 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. = :( >=20 > 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. Eve= n > on POSIX platforms the signal might not be necessary anymore. If you don't have that signal / SuspendThread/ResumtThread requirement, might that enable QEMU to just depend on the winpthreads library that is provided by Mingw project, and not bother reinventing the wheel for thread library portabilty ? Regards, Daniel --=20 |: http://berrange.com -o- http://www.flickr.com/photos/dberrange= / :| |: http://libvirt.org -o- http://virt-manager.or= g :| |: http://autobuild.org -o- http://search.cpan.org/~danberr= / :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vn= c :|