Paolo Bonzini e70372fcaf lockable: add QemuLockable
QemuLockable is a polymorphic lock type that takes an object and
knows which function to use for locking and unlocking.  The
implementation could use C11 _Generic, but since the support is
not very widespread I am instead using __builtin_choose_expr and
__builtin_types_compatible_p, which are already used by
include/qemu/atomic.h.

QemuLockable can be used to implement lock guards, or to pass around
a lock in such a way that a function can release it and re-acquire it.
The next patch will do this for CoQueue.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20180203153935.8056-3-pbonzini@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
2018-02-08 09:22:03 +08:00
..
2017-09-22 10:46:25 +08:00
2017-10-11 15:15:17 -03:00
2017-11-17 18:21:30 +01:00
2017-06-20 14:31:31 +02:00
2018-01-16 14:54:49 +01:00
2017-03-01 11:51:28 +04:00
2017-03-01 11:51:28 +04:00
2017-03-01 11:51:05 +04:00
2017-03-01 11:51:04 +04:00
2017-03-01 11:51:28 +04:00
2017-08-10 14:33:43 +01:00
2017-10-20 13:32:10 +02:00
2017-03-01 11:51:05 +04:00
2017-10-20 13:32:10 +02:00
2017-10-20 13:32:10 +02:00
2017-10-20 13:32:10 +02:00
2018-02-06 19:28:08 +00:00
2017-09-15 09:05:19 +02:00
2017-03-01 00:09:28 +04:00
2017-03-01 00:09:28 +04:00
2018-01-16 14:54:50 +01:00
2017-10-20 13:32:10 +02:00
2017-01-10 08:49:59 -08:00
2018-02-08 09:22:03 +08:00
2017-12-18 10:54:13 -05:00
2017-09-05 22:34:40 +02:00
2017-12-20 22:01:24 +08:00
2018-01-29 14:22:50 -05:00
2017-03-01 11:51:29 +04:00