]> git.proxmox.com Git - mirror_qemu.git/commit - util/qemu-thread-win32.c
win32: replace custom mutex and condition variable with native primitives
authorAndrey Shedel <ashedel@microsoft.com>
Fri, 24 Mar 2017 22:01:41 +0000 (15:01 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 27 Mar 2017 12:41:01 +0000 (14:41 +0200)
commit12f8def0e02232d7c6416ad9b66640f973c531d1
treef9fd9f5eec4dd121034a8a16ded54fcfd6c4c4cc
parentdfd0dcc71724b11e125f67c8710c50c41da6ee4a
win32: replace custom mutex and condition variable with native primitives

The multithreaded TCG implementation exposed deadlocks in the win32
condition variables: as implemented, qemu_cond_broadcast waited on
receivers, whereas the pthreads API it was intended to emulate does
not. This was causing a deadlock because broadcast was called while
holding the IO lock, as well as all possible waiters blocked on the
same lock.

This patch replaces all the custom synchronisation code for mutexes
and condition variables with native Windows primitives (SRWlocks and
condition variables) with the same semantics as their POSIX
equivalents. To enable that, it requires a Windows Vista or newer host
OS.

Signed-off-by: Andrey Shedel <ashedel@microsoft.com>
[AB: edited commit message]
Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
Message-Id: <20170324220141.10104-1-Andrew.Baumann@microsoft.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/qemu/thread-win32.h
util/qemu-thread-win32.c