Stefan Hajnoczi c1fe694357 coroutine-win32: use QEMU_DEFINE_STATIC_CO_TLS()
Thread-Local Storage variables cannot be used directly from coroutine
code because the compiler may optimize TLS variable accesses across
qemu_coroutine_yield() calls. When the coroutine is re-entered from
another thread the TLS variables from the old thread must no longer be
used.

Use QEMU_DEFINE_STATIC_CO_TLS() for the current and leader variables.

I think coroutine-win32.c could get away with __thread because the
variables are only used in situations where either the stale value is
correct (current) or outside coroutine context (loading leader when
current is NULL). Due to the difficulty of being sure that this is
really safe in all scenarios it seems worth converting it anyway.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20220307153853.602859-4-stefanha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2022-05-04 15:55:23 +02:00
..
2022-03-15 13:57:44 +08:00
2022-04-21 17:03:51 +04:00
2022-04-20 10:51:11 -07:00
2022-05-03 15:17:30 +04:00
2021-07-09 18:20:27 +02:00
2020-12-10 17:16:44 +01:00
2022-04-28 08:51:56 +02:00
2022-03-04 18:14:40 +01:00
2021-07-09 18:20:27 +02:00
2021-04-01 15:27:44 +04:00