On 11/05/2021 10:37, Paolo Bonzini wrote:
On 07/05/21 17:29, Eric Blake wrote:
+ qemu_mutex_lock(&s->lock);
QLIST_FOREACH(r, &s->suspended_reqs, next) {
if (!strcmp(r->tag, tag)) {
+ qemu_mutex_unlock(&s->lock);
return true;
}
}
+ qemu_mutex_unlock(&s->lock);
return false;
Would code like this be easier to write by using QEMU_LOCK_GUARD from
lockable.h?
Yes, this one would. In other cases (rule_check) it's not so clear cut.
It depends whether you prefer to have the simplest code, or rather to
have homogeneous use of either guards or lock/unlock.
Makes sense. I will use the lock guard and fix the "yield" typos in the
other patches.
Thank you,
Emanuele