qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 6/8] include/qemu/lockable: Use _Generic instead of QEMU_GENE


From: Richard Henderson
Subject: Re: [PATCH 6/8] include/qemu/lockable: Use _Generic instead of QEMU_GENERIC
Date: Mon, 14 Jun 2021 07:47:46 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 6/14/21 4:14 AM, Paolo Bonzini wrote:
On 12/06/21 01:33, Richard Henderson wrote:
-                 unknown_lock_type))
+/* Auxiliary macros to simplify QEMU_MAKE_LOCABLE.  */
+#define QEMU_LOCK_FUNC(x) ((QemuLockUnlockFunc *)      \
+    _Generic((x), QemuMutex *: qemu_mutex_lock,        \
+                  QemuRecMutex *: qemu_rec_mutex_lock, \
+                  CoMutex *: qemu_co_mutex_lock,       \
+                  QemuSpin *: qemu_spin_lock))
+
+#define QEMU_UNLOCK_FUNC(x) ((QemuLockUnlockFunc *)      \
+    _Generic((x), QemuMutex *: qemu_mutex_unlock,        \
+                  QemuRecMutex *: qemu_rec_mutex_unlock, \
+                  CoMutex *: qemu_co_mutex_unlock,       \
+                  QemuSpin *: qemu_spin_unlock))

These are not needed anymore, are they?

Otherwise I agree that it's both more and less complicated.  The duplication between QEMU_MAKE_LOCKABLE_NONNULL and QEMU_MAKE_LOCKABLE is tolerable.

Yep, I didn't notice that they were only used by MAKE_LOCKABLE.

r~




reply via email to

[Prev in Thread] Current Thread [Next in Thread]