[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/5] semaphore: implement fallback counting sema
From: |
Brad Smith |
Subject: |
Re: [Qemu-devel] [PATCH 2/5] semaphore: implement fallback counting semaphores with mutex+condvar |
Date: |
Mon, 26 Nov 2012 21:56:20 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Sun, Nov 18, 2012 at 05:06:40PM +0100, Paolo Bonzini wrote:
> Il 18/11/2012 10:09, Brad Smith ha scritto:
> > On 11/02/12 09:14, Paolo Bonzini wrote:
> >> OpenBSD and Darwin do not have sem_timedwait. Implement a fallback
> >> for them.
> >>
> >> Signed-off-by: Paolo Bonzini <address@hidden>
> >> ---
> >> qemu-thread-posix.c | 74
> >> +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >> qemu-thread-posix.h | 6 +++++
> >> 2 file modificati, 80 inserzioni(+)
> >>
> >> diff --git a/qemu-thread-posix.c b/qemu-thread-posix.c
> >> index 6a3d3a1..048db8f 100644
> >> --- a/qemu-thread-posix.c
> >> +++ b/qemu-thread-posix.c
> >> @@ -122,36 +122,100 @@ void qemu_sem_init(QemuSemaphore *sem, int init)
> >> {
> >> int rc;
> >>
> >> +#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__)
> >
> > OpenBSD 5.2 & -current (libpthread) / NetBSD -current (librt) have
> > supported sem_timedwait() for roughly 8 months now. Please change this
> > to properly test for the presence of sem_timedwait() within the
> > configure script.
>
> Please submit a patch. The patched code works, and it's not even
> suboptimal because *BSD use a mutex/condvar to implement semaphores. We
> end up executing the very same code.
I understand what you mean. It's more so out of principle to try and remove
workarounds wherever possible when it is possible to do so.
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.