coroutine-lock: make CoMutex thread-safe
commitfed20a70e39bb9385020bdc4e8839d95326df8e2
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 13 Feb 2017 18:12:39 +0000 (13 19:12 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Tue, 21 Feb 2017 11:39:40 +0000 (21 11:39 +0000)
tree07af96e10e918b1393a1ea94205f8802f4a0d1df
parent91bcea4899017891983b9149bd50cb283e78dfc0
coroutine-lock: make CoMutex thread-safe

This uses the lock-free mutex described in the paper '"Blocking without
Locking", or LFTHREADS: A lock-free thread library' by Gidenstam and
Papatriantafilou.  The same technique is used in OSv, and in fact
the code is essentially a conversion to C of OSv's code.

[Added missing coroutine_fn in tests/test-aio-multithread.c.
--Stefan]

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 20170213181244.16297-2-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
include/qemu/coroutine.h
tests/test-aio-multithread.c
util/qemu-coroutine-lock.c
util/trace-events