From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LbcYL-0004Hm-Sg for qemu-devel@nongnu.org; Mon, 23 Feb 2009 10:17:05 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LbcYK-0004Fq-4B for qemu-devel@nongnu.org; Mon, 23 Feb 2009 10:17:05 -0500 Received: from [199.232.76.173] (port=42016 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LbcYK-0004Fn-1F for qemu-devel@nongnu.org; Mon, 23 Feb 2009 10:17:04 -0500 Received: from qw-out-1920.google.com ([74.125.92.150]:50645) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LbcYJ-0002Gt-Pq for qemu-devel@nongnu.org; Mon, 23 Feb 2009 10:17:03 -0500 Received: by qw-out-1920.google.com with SMTP id 4so591671qwk.4 for ; Mon, 23 Feb 2009 07:17:02 -0800 (PST) Message-ID: <49A2BDCF.1000401@codemonkey.ws> Date: Mon, 23 Feb 2009 09:16:31 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [6631] Avoid infinite loop around timed condition variable References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 >> >> 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 >> #include >> #include >> -#include >> +#include >> #include >> #include >> #include >> @@ -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); >> } >> >> >> >> >> >