From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF76k-0002lq-JZ for qemu-devel@nongnu.org; Thu, 29 Aug 2013 14:38:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VF76f-0007v0-Ni for qemu-devel@nongnu.org; Thu, 29 Aug 2013 14:38:14 -0400 Received: from [2a03:4000:1::4e2f:c7ac:d] (port=56271 helo=v220110690675601.yourvserver.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF76f-0007r8-Gj for qemu-devel@nongnu.org; Thu, 29 Aug 2013 14:38:09 -0400 Message-ID: <521F950B.9000103@weilnetz.de> Date: Thu, 29 Aug 2013 20:38:03 +0200 From: Stefan Weil MIME-Version: 1.0 References: <1377800368-12232-1-git-send-email-alex@alex.org.uk> In-Reply-To: <1377800368-12232-1-git-send-email-alex@alex.org.uk> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] aio / timers: use g_usleep() not sleep() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Bligh Cc: Kevin Wolf , Anthony Liguori , Jan Kiszka , qemu-devel@nongnu.org, liu ping fan , Charlie Shepherd , Gerd Hoffmann , Stefan Hajnoczi , Anthony Perard , Paolo Bonzini , MORITA Kazutaka , rth@twiddle.net Am 29.08.2013 20:19, schrieb Alex Bligh: > sleep() apparently doesn't exist under mingw. Use g_usleep for > portability. > > Signed-off-by: Alex Bligh > --- > tests/test-aio.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/tests/test-aio.c b/tests/test-aio.c > index 4215701..110fa4a 100644 > --- a/tests/test-aio.c > +++ b/tests/test-aio.c > @@ -400,7 +400,7 @@ static void test_timer_schedule(void) > g_assert(!aio_poll(ctx, false)); > g_assert_cmpint(data.n, ==, 0); > > - sleep(1); > + g_usleep(1*G_USEC_PER_SEC); > g_assert_cmpint(data.n, ==, 0); > > g_assert(aio_poll(ctx, false)); > @@ -736,7 +736,7 @@ static void test_source_timer_schedule(void) > > g_assert_cmpint(data.n, ==, 0); > > - sleep(1); > + g_usleep(1*G_USEC_PER_SEC); > g_assert_cmpint(data.n, ==, 0); > > g_assert(g_main_context_iteration(NULL, false)); > @@ -746,7 +746,7 @@ static void test_source_timer_schedule(void) > do { > g_assert(g_main_context_iteration(NULL, true)); > } while (qemu_clock_get_ns(data.clock_type) <= expiry); > - sleep(1); > + g_usleep(1*G_USEC_PER_SEC); > g_main_context_iteration(NULL, false); > > g_assert_cmpint(data.n, ==, 2); Although checkpatch.pl does not complain, I'd prefer a blank before and after operators like "*". Here a simple g_usleep(G_USEC_PER_SEC) would be even better. Otherwise this patch is fine. Regards, Stefan