Skip to content
  • Paolo Bonzini's avatar
    ef57137f
    qemu-thread: add per-thread atexit functions · ef57137f
    Paolo Bonzini authored
    
    
    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: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Reviewed-by: default avatarFam Zheng <famz@redhat.com>
    Message-id: 1417518350-6167-3-git-send-email-pbonzini@redhat.com
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    ef57137f
    qemu-thread: add per-thread atexit functions
    Paolo Bonzini authored
    
    
    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: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Reviewed-by: default avatarFam Zheng <famz@redhat.com>
    Message-id: 1417518350-6167-3-git-send-email-pbonzini@redhat.com
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Loading