Re: [Qemu-devel] [PATCH] coroutine: Fix win32 variant for older mingw32 compilers

2012-11-22 Thread Jan Kiszka
On 2012-11-21 20:11, Stefan Weil wrote: > Am 21.11.2012 15:38, schrieb Paolo Bonzini: >> Il 21/11/2012 15:33, malc ha scritto: >>> Leaking leader is a bit bad, but it looks ok for 1.3. > Hmm. A TLS destructor is apparently not available. Is there some "on > thread termination" callback

Re: [Qemu-devel] [PATCH] coroutine: Fix win32 variant for older mingw32 compilers

2012-11-22 Thread Paolo Bonzini
Il 21/11/2012 20:11, Stefan Weil ha scritto: > > Debian cross development is full of difficulties. Passing an extra > compiler option like -mthread is only one of these difficulties. > I updated http://wiki.qemu.org/Hosts/W32, so anybody who really > wants to run cross compilations on Debian can g

Re: [Qemu-devel] [PATCH] coroutine: Fix win32 variant for older mingw32 compilers

2012-11-21 Thread Stefan Weil
Am 21.11.2012 15:38, schrieb Paolo Bonzini: Il 21/11/2012 15:33, malc ha scritto: Leaking leader is a bit bad, but it looks ok for 1.3. Hmm. A TLS destructor is apparently not available. Is there some "on thread termination" callback mechanism on Windows? Didn't find one on first glance. Dlls

Re: [Qemu-devel] [PATCH] coroutine: Fix win32 variant for older mingw32 compilers

2012-11-21 Thread Jan Kiszka
On 2012-11-21 16:54, Paolo Bonzini wrote: > Il 21/11/2012 16:44, Jan Kiszka ha scritto: > Leaking leader is a bit bad, but it looks ok for 1.3. Hmm. A TLS destructor is apparently not available. Is there some "on thread termination" callb

Re: [Qemu-devel] [PATCH] coroutine: Fix win32 variant for older mingw32 compilers

2012-11-21 Thread Paolo Bonzini
Il 21/11/2012 16:44, Jan Kiszka ha scritto: Leaking leader is a bit bad, but it looks ok for 1.3. >> > >> > Hmm. A TLS destructor is apparently not available. Is there some >> > "on >> > thread termination" callback mechanism on Windows? Didn't find one >>

Re: [Qemu-devel] [PATCH] coroutine: Fix win32 variant for older mingw32 compilers

2012-11-21 Thread Jan Kiszka
On 2012-11-21 15:49, Jan Kiszka wrote: > On 2012-11-21 15:38, Paolo Bonzini wrote: >> Il 21/11/2012 15:33, malc ha scritto: >>> Leaking leader is a bit bad, but it looks ok for 1.3. > > Hmm. A TLS destructor is apparently not available. Is there some "on > thread termination" callba

Re: [Qemu-devel] [PATCH] coroutine: Fix win32 variant for older mingw32 compilers

2012-11-21 Thread Jan Kiszka
On 2012-11-21 15:38, Paolo Bonzini wrote: > Il 21/11/2012 15:33, malc ha scritto: >> Leaking leader is a bit bad, but it looks ok for 1.3. Hmm. A TLS destructor is apparently not available. Is there some "on thread termination" callback mechanism on Windows? Didn't find one on >>

Re: [Qemu-devel] [PATCH] coroutine: Fix win32 variant for older mingw32 compilers

2012-11-21 Thread Paolo Bonzini
Il 21/11/2012 15:33, malc ha scritto: >>> > > Leaking leader is a bit bad, but it looks ok for 1.3. >> > >> > Hmm. A TLS destructor is apparently not available. Is there some "on >> > thread termination" callback mechanism on Windows? Didn't find one on >> > first glance. >> > > Dlls receive some

Re: [Qemu-devel] [PATCH] coroutine: Fix win32 variant for older mingw32 compilers

2012-11-21 Thread malc
On Wed, 21 Nov 2012, Jan Kiszka wrote: > On 2012-11-21 15:08, Paolo Bonzini wrote: > > Il 21/11/2012 15:00, Jan Kiszka ha scritto: > >> +if (!TlsGetValue(current_tls_index)) { > >> +leader = g_malloc0(sizeof(*leader)); > >> +leader->fiber = ConvertThreadToFiber(NULL); > >> +

Re: [Qemu-devel] [PATCH] coroutine: Fix win32 variant for older mingw32 compilers

2012-11-21 Thread Jan Kiszka
On 2012-11-21 15:08, Paolo Bonzini wrote: > Il 21/11/2012 15:00, Jan Kiszka ha scritto: >> +if (!TlsGetValue(current_tls_index)) { >> +leader = g_malloc0(sizeof(*leader)); >> +leader->fiber = ConvertThreadToFiber(NULL); >> +TlsSetValue(current_tls_index, &leader->base);

[Qemu-devel] [PATCH] coroutine: Fix win32 variant for older mingw32 compilers

2012-11-21 Thread Jan Kiszka
mingw32 with gcc up to (at least) 4.4 has broken __thread support. This means all __thread variables silently become global ones. Address this by switching the coroutine implementation for win32 to Get/SetTlsValue. Signed-off-by: Jan Kiszka --- coroutine-win32.c | 29 ++---

Re: [Qemu-devel] [PATCH] coroutine: Fix win32 variant for older mingw32 compilers

2012-11-21 Thread Paolo Bonzini
Il 21/11/2012 15:00, Jan Kiszka ha scritto: > +if (!TlsGetValue(current_tls_index)) { > +leader = g_malloc0(sizeof(*leader)); > +leader->fiber = ConvertThreadToFiber(NULL); > +TlsSetValue(current_tls_index, &leader->base); > } Leaking leader is a bit bad, but it lo