[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 07/12] qemu-thread: add QemuSemaphore
From: |
Jan Kiszka |
Subject: |
Re: [Qemu-devel] [PATCH 07/12] qemu-thread: add QemuSemaphore |
Date: |
Mon, 16 Jul 2012 14:00:17 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
On 2012-07-16 12:42, Paolo Bonzini wrote:
> The new thread pool will use semaphores instead of condition
> variables, because QemuCond does not have qemu_cond_timedwait.
I'll post an updated patch (according to last round's review comments)
that adds this service for POSIX. I bet you'll find a way to extend it
to Win32 if that is required. ;)
> (I also like it more this way, since semaphores model well the
> producer-consumer problem).
Let's not introduce another synchronization mechanism unless there is a
real need. Semaphores tend to be misused for things they don't fit, so
better keep them out of reach.
Also, if you do producer-consumer this way, you need a down() for every
entity you dequeue. In contrast, you only interact with condition
variables if there the consumer queue is empty - less atomic ops.
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
- [Qemu-devel] [PATCH 01/12] event_notifier: enable it to use pipes, (continued)
- [Qemu-devel] [PATCH 01/12] event_notifier: enable it to use pipes, Paolo Bonzini, 2012/07/16
- [Qemu-devel] [PATCH 02/12] event_notifier: add Win32 implementation, Paolo Bonzini, 2012/07/16
- [Qemu-devel] [PATCH 04/12] aio: provide platform-independent API, Paolo Bonzini, 2012/07/16
- [Qemu-devel] [PATCH 03/12] main-loop: use event notifiers, Paolo Bonzini, 2012/07/16
- [Qemu-devel] [PATCH 05/12] aio: add Win32 implementation, Paolo Bonzini, 2012/07/16
- [Qemu-devel] [PATCH 06/12] linux-aio: use event notifiers, Paolo Bonzini, 2012/07/16
- [Qemu-devel] [PATCH 07/12] qemu-thread: add QemuSemaphore, Paolo Bonzini, 2012/07/16
- Re: [Qemu-devel] [PATCH 07/12] qemu-thread: add QemuSemaphore,
Jan Kiszka <=
- [Qemu-devel] [PATCH] qemu-thread: Introduce qemu_cond_timedwait for POSIX, Jan Kiszka, 2012/07/16
- Re: [Qemu-devel] [PATCH 07/12] qemu-thread: add QemuSemaphore, Paolo Bonzini, 2012/07/16
- Re: [Qemu-devel] [PATCH 07/12] qemu-thread: add QemuSemaphore, Jan Kiszka, 2012/07/16
- Re: [Qemu-devel] [PATCH 07/12] qemu-thread: add QemuSemaphore, Paolo Bonzini, 2012/07/16
- Re: [Qemu-devel] [PATCH 07/12] qemu-thread: add QemuSemaphore, Jan Kiszka, 2012/07/16
- Re: [Qemu-devel] [PATCH 07/12] qemu-thread: add QemuSemaphore, Paolo Bonzini, 2012/07/16
- Re: [Qemu-devel] [PATCH 07/12] qemu-thread: add QemuSemaphore, Jan Kiszka, 2012/07/16
- Re: [Qemu-devel] [PATCH 07/12] qemu-thread: add QemuSemaphore, Paolo Bonzini, 2012/07/16
- Re: [Qemu-devel] [PATCH 07/12] qemu-thread: add QemuSemaphore, Paolo Bonzini, 2012/07/24
[Qemu-devel] [PATCH 08/12] aio: add generic thread-pool facility, Paolo Bonzini, 2012/07/16