[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] Using TLS instead of __thread in coroutines imp
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] Using TLS instead of __thread in coroutines implementation for win32 |
Date: |
Mon, 16 Apr 2012 10:56:18 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 |
Il 16/04/2012 10:17, Pavel Dovgaluk ha scritto:
> Coroutine *qemu_coroutine_self(void)
> {
> + Coroutine *current = qemu_coroutine_get_current();
> +
> if (!current) {
> - current = &leader.base;
> - leader.fiber = ConvertThreadToFiber(NULL);
> + CoroutineWin32 *co = g_malloc0(sizeof(*co));
> + current = &co->base;
> + co->fiber = ConvertThreadToFiber(NULL);
> + qemu_coroutine_set_current(current);
> }
This leaks the leader. :(
Unfortunately, Win32 TLS doesn't have destructors. Windows 2003 and
Vista have fiber-local storage that does have destructors and would
solve the problem even more nicely.
http://msdn.microsoft.com/en-us/library/ms683146 says it's not in XP,
but http://blogs.msdn.com/b/slavao/archive/2005/02/28/381649.aspx says
it does. Perhaps some recent service pack? Stefan, do you have any ideas?
Paolo
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH] Using TLS instead of __thread in coroutines implementation for win32,
Paolo Bonzini <=