qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] semaphore: fix a hangup problem underload o


From: Izumi Tsutsui
Subject: Re: [Qemu-devel] [PATCH v2] semaphore: fix a hangup problem underload on NetBSD hosts.
Date: Wed, 3 Jul 2013 17:50:03 +0900

Laszlo Ersek wrote:

> On 07/02/13 18:54, Izumi Tsutsui wrote:
 :
> > @@ -249,16 +250,19 @@ int qemu_sem_timedwait(QemuSemaphore *sem, int ms)
> >  
> >  void qemu_sem_wait(QemuSemaphore *sem)
> >  {
> > +    int rc;
> > +
> >  #if defined(__APPLE__) || defined(__NetBSD__)
> >      pthread_mutex_lock(&sem->lock);
> > -    --sem->count;
> > -    while (sem->count < 0) {
> > +    while (sem->count == 0) {
> >          pthread_cond_wait(&sem->cond, &sem->lock);
> > +        if (rc != 0) {
> > +            error_exit(rc, __func__);
> > +        }
> 
> You forgot to store the retval of pthread_cond_wait() in "rc", the
> (rc!=0) check refers to an indeterminate value.

Yes, I was a bit hasty and probably missed gcc warnings.
(there is no qemu_sem_wait() callers currently)

I'll post v3 one.

Thanks,
---
Izumi Tsutsui



reply via email to

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