qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block/curl: Replace usleep by g_usleep
@ 2012-03-31 15:34 Stefan Weil
  2012-04-02 13:00 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Weil @ 2012-03-31 15:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Kevin Wolf, Stefan Weil

The function usleep is not available for all supported platforms:
at least some versions of MinGW don't support it.

usleep was also declared obsolete by POSIX.1-2001.

The function g_usleep is part of glib2.0, so it is available for
all supported platforms.

Using nanosleep would also be possible but needs more code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 block/curl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/block/curl.c b/block/curl.c
index e9102e3..a909eca 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -282,7 +282,7 @@ static CURLState *curl_init_state(BDRVCURLState *s)
             break;
         }
         if (!state) {
-            usleep(100);
+            g_usleep(100);
             curl_multi_do(s);
         }
     } while(!state);
-- 
1.7.9

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] block/curl: Replace usleep by g_usleep
  2012-03-31 15:34 [Qemu-devel] [PATCH] block/curl: Replace usleep by g_usleep Stefan Weil
@ 2012-04-02 13:00 ` Stefan Hajnoczi
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2012-04-02 13:00 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-trivial, Kevin Wolf, qemu-devel

On Sat, Mar 31, 2012 at 05:34:41PM +0200, Stefan Weil wrote:
> The function usleep is not available for all supported platforms:
> at least some versions of MinGW don't support it.
> 
> usleep was also declared obsolete by POSIX.1-2001.
> 
> The function g_usleep is part of glib2.0, so it is available for
> all supported platforms.
> 
> Using nanosleep would also be possible but needs more code.
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  block/curl.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-02 13:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-31 15:34 [Qemu-devel] [PATCH] block/curl: Replace usleep by g_usleep Stefan Weil
2012-04-02 13:00 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi

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).