qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC 1/2] sem-posix: remove the posix semaphore support


From: Paolo Bonzini
Subject: Re: [RFC 1/2] sem-posix: remove the posix semaphore support
Date: Wed, 23 Feb 2022 10:42:31 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

On 2/21/22 12:11, Daniel P. Berrangé wrote:
As a point of history, the original  code only used sem_t. The pthreads
based fallback was introduced by Paolo in

   commit c166cb72f1676855816340666c3b618beef4b976
   Author: Paolo Bonzini <pbonzini@redhat.com>
   Date:   Fri Nov 2 15:43:21 2012 +0100

     semaphore: implement fallback counting semaphores with mutex+condvar
OpenBSD and Darwin do not have sem_timedwait. Implement a fallback
     for them.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
     Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

I'm going to assume this fallback impl is less efficient than the
native sem_t impl as the reason for leaving the original impl, or
maybe Paolo just want to risk accidental bugs by removing the
existing usage ?

Yes, it is a bit less efficient. But really there aren't any places where semaphores vs. mutex+condvar will make a difference. The original reason to use semaphores was that Windows had a hand-written condition variable implementation that didn't support cond_timedwait.

Paolo



reply via email to

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