[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] rfifolock: add recursive FIFO lock
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] rfifolock: add recursive FIFO lock |
Date: |
Wed, 09 Oct 2013 12:05:43 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9 |
Il 09/10/2013 11:55, Stefan Hajnoczi ha scritto:
> + /* Take a ticket */
> + unsigned int ticket = r->tail++;
> +
> + if (r->nesting > 0) {
> + if (qemu_thread_is_self(&r->owner_thread)) {
> + r->tail--; /* put ticket back, we're nesting */
> + } else {
ticket is dead in the "nested" path, why not move it (and the increment)
directly after the else?
Otherwise, the code is very nice. It's very interesting that no pthread
mutex is held in the rfifolock critical section, so that the thread that
holds the next ticket has a chance to be woken up.
Paolo
[Qemu-devel] [PATCH 2/2] aio: add aio_context_acquire() and aio_context_release(), Stefan Hajnoczi, 2013/10/09
Re: [Qemu-devel] [PATCH 0/2] aio: add aio_context_acquire() and aio_context_release(), Paolo Bonzini, 2013/10/09