[PATCH] qga: replace usleep() with g_usleep()

marcandre.lureau@redhat.com posted 1 patch 3 years, 10 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220331205339.2048330-1-marcandre.lureau@redhat.com
Maintainers: Michael Roth <michael.roth@amd.com>
qga/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] qga: replace usleep() with g_usleep()
Posted by marcandre.lureau@redhat.com 3 years, 10 months ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

The latter simply requires glib.h, while the former is not in the
Windows API (but provided by mingw header & CRT)

Also simplify the expression for 1/10s.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 qga/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qga/main.c b/qga/main.c
index 1deb0ee2fbfe..6a5be23225d0 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -610,7 +610,7 @@ static gboolean channel_event_cb(GIOCondition condition, gpointer data)
          * host-side chardev. sleep a bit to mitigate this
          */
         if (s->virtio) {
-            usleep(100 * 1000);
+            g_usleep(G_USEC_PER_SEC / 10);
         }
         return true;
     default:
-- 
2.35.1.693.g805e0a68082a


Re: [PATCH] qga: replace usleep() with g_usleep()
Posted by Philippe Mathieu-Daudé 3 years, 10 months ago
On 31/3/22 22:53, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> The latter simply requires glib.h, while the former is not in the
> Windows API (but provided by mingw header & CRT)
> 
> Also simplify the expression for 1/10s.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   qga/main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>