|
From: | Emanuele Giuseppe Esposito |
Subject: | Re: [PATCH v2 5/5] blkdebug: protect rules and suspended_reqs with a lock |
Date: | Tue, 11 May 2021 11:08:26 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |