qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [6631] Avoid infinite loop around timed condition variable
Date: Mon, 23 Feb 2009 09:16:31 -0600	[thread overview]
Message-ID: <49A2BDCF.1000401@codemonkey.ws> (raw)
In-Reply-To: <BAY110-DAV7930C639AE2E3B65498B1B9B00@phx.gbl>

C.W. Betts wrote:
> Will these patches help with the OS X hang?

No.  I thought that got resolved?  Maybe I forgot to push the patch?

Regards,

Anthony Liguori

> On Feb 20, 2009, at 10:48 PM, malc wrote:
>
>> Revision: 6631
>>          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6631 
>> <http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6631>
>> Author:   malc
>> Date:     2009-02-21 05:48:13 +0000 (Sat, 21 Feb 2009)
>>
>> Log Message:
>> -----------
>> Avoid infinite loop around timed condition variable
>>
>> This can happen due to spurious wakeups
>>
>> Modified Paths:
>> --------------
>>    trunk/posix-aio-compat.c
>>
>> Modified: trunk/posix-aio-compat.c
>> ===================================================================
>> --- trunk/posix-aio-compat.c 2009-02-21 05:48:11 UTC (rev 6630)
>> +++ trunk/posix-aio-compat.c 2009-02-21 05:48:13 UTC (rev 6631)
>> @@ -14,7 +14,7 @@
>> #include <pthread.h>
>> #include <unistd.h>
>> #include <errno.h>
>> -#include <sys/time.h>
>> +#include <time.h>
>> #include <string.h>
>> #include <stdlib.h>
>> #include <stdio.h>
>> @@ -86,16 +86,17 @@
>>         struct qemu_paiocb *aiocb;
>>         size_t offset;
>>         int ret = 0;
>> +        qemu_timeval tv;
>> +        struct timespec ts;
>>
>> +        qemu_gettimeofday(&tv);
>> +        ts.tv_sec = tv.tv_sec + 10;
>> +        ts.tv_nsec = 0;
>> +
>>         mutex_lock(&lock);
>>
>>         while (TAILQ_EMPTY(&request_list) &&
>>                !(ret == ETIMEDOUT)) {
>> -            struct timespec ts = { 0 };
>> -            qemu_timeval tv;
>> -
>> -            qemu_gettimeofday(&tv);
>> -            ts.tv_sec = tv.tv_sec + 10;
>>             ret = cond_timedwait(&cond, &lock, &ts);
>>         }
>>
>>
>>
>>
>>
>

  parent reply	other threads:[~2009-02-23 15:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-21  5:48 [Qemu-devel] [6631] Avoid infinite loop around timed condition variable malc
     [not found] ` <9D64DDB2-3C4E-457D-B1E6-4B56ED65331C@hotmail.com>
2009-02-21  5:58   ` C.W. Betts
2009-02-21  6:43     ` malc
2009-02-23 15:16     ` Anthony Liguori [this message]
2009-02-23 15:19     ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49A2BDCF.1000401@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).