qemu-thread: add per-thread atexit functions