Skip to contentSkip to conversation

block/curl: Replace usleep by g_usleep

PATCH Applied Stefan Weil 2 participants 2 messages Mar 31, 2012 – Apr 2, 2012 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block/curl: Replace usleep by g_usleep

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.

---
 block/curl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
block/curl.c +1 -1
index e9102e3..a909eca 100644
@@ -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);
Signature · 1 line
1.7.9
#1 lore raw
Quoted 8 lines · 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.

Quoted 6 lines

Using nanosleep would also be possible but needs more code.

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