summary refs log tree commit diff stats
path: root/util/qemu-thread-posix.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2017-01-12 19:07:52 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2017-01-16 13:25:17 +0000
commit51dee5e465e1b3454a886792ca3e14b851e8e67d (patch)
tree33d418609cae2d5251a509cf60dce904dd714bc4 /util/qemu-thread-posix.c
parentcf2c02c8ea0f2d7888f3b45b20e7eb24b47a93f1 (diff)
downloadfocaccia-qemu-51dee5e465e1b3454a886792ca3e14b851e8e67d.tar.gz
focaccia-qemu-51dee5e465e1b3454a886792ca3e14b851e8e67d.zip
qemu-thread: introduce QemuLockCnt
A QemuLockCnt comprises a counter and a mutex, with primitives
to increment and decrement the counter, and to take and release the
mutex.  It can be used to do lock-free visits to a data structure
whenever mutexes would be too heavy-weight and the critical section
is too long for RCU.

This could be implemented simply by protecting the counter with the
mutex, but QemuLockCnt is harder to misuse and more efficient.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20170112180800.21085-3-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'util/qemu-thread-posix.c')
0 files changed, 0 insertions, 0 deletions