]> Git Repo - qemu.git/commit - util/qemu-thread-posix.c
qemu-thread: add per-thread atexit functions
authorPaolo Bonzini <[email protected]>
Tue, 2 Dec 2014 11:05:45 +0000 (12:05 +0100)
committerStefan Hajnoczi <[email protected]>
Tue, 13 Jan 2015 13:43:29 +0000 (13:43 +0000)
commitef57137f1b30545a477ab798d34a669b0abf5320
tree72fbda74c56d638e7ee78c0e21d8053219d385f0
parentd1d1b206b07977fe0e75b0254e5b50c215c97803
qemu-thread: add per-thread atexit functions

Destructors are the main additional feature of pthread TLS compared
to __thread.  If we were using C++ (hint, hint!) we could have used
thread-local objects with a destructor.  Since we are not, instead,
we add a simple Notifier-based API.

Note that the notifier must be per-thread as well.  We can add a
global list as well later, perhaps.

The Win32 implementation has some complications because a) detached
threads used not to have a QemuThreadData; b) the main thread does
not go through win32_start_routine, so we have to use atexit too.

Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Message-id: 1417518350[email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
include/qemu/thread.h
util/qemu-thread-posix.c
util/qemu-thread-win32.c
This page took 0.02166 seconds and 4 git commands to generate.