qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] rfifolock: no need to get thread identifier whe


From: Denis V. Lunev
Subject: Re: [Qemu-devel] [PATCH] rfifolock: no need to get thread identifier when nesting
Date: Tue, 10 May 2016 12:38:12 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

On 05/10/2016 12:16 PM, Changlong Xie wrote:
Signed-off-by: Changlong Xie <address@hidden>
---
  util/rfifolock.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/util/rfifolock.c b/util/rfifolock.c
index c22f5fe..f406cc1 100644
--- a/util/rfifolock.c
+++ b/util/rfifolock.c
@@ -50,6 +50,7 @@ void rfifolock_lock(RFifoLock *r)
if (r->nesting > 0 && qemu_thread_is_self(&r->owner_thread)) {
          r->tail--; /* put ticket back, we're nesting */
+        goto out;
      } else {
          while (ticket != r->head) {
              /* Invoke optional contention callback */
@@ -61,6 +62,7 @@ void rfifolock_lock(RFifoLock *r)
      }
qemu_thread_get_self(&r->owner_thread);
+out:
      r->nesting++;
      qemu_mutex_unlock(&r->lock);
  }
it would be better to put
    qemu_thread_get_self(&r->owner_thread);
2 lines up and avoid unnecessary goto



reply via email to

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