From: Mohamed Mediouni <mohamed@unpredictable.fr>
To: qemu-devel@nongnu.org
Cc: "Stefan Weil" <sw@weilnetz.de>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Werner de Carne" <werner@carne.de>
Subject: [PATCH 1/3] serial COM: windows serial COM PollingFunc don't sleep
Date: Mon, 13 Apr 2026 18:43:36 +0200 [thread overview]
Message-ID: <20260413164338.42894-2-mohamed@unpredictable.fr> (raw)
In-Reply-To: <20260413164338.42894-1-mohamed@unpredictable.fr>
From: Werner de Carne <werner@carne.de>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1802
Signed-off-by: Werner de Carne <werner@carne.de>
---
chardev/char-win.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/chardev/char-win.c b/chardev/char-win.c
index fef45e83aa..f13d526e2f 100644
--- a/chardev/char-win.c
+++ b/chardev/char-win.c
@@ -28,7 +28,7 @@
#include "qapi/error.h"
#include "chardev/char-win.h"
-static void win_chr_read(Chardev *chr, DWORD len)
+static int win_chr_read(Chardev *chr, DWORD len)
{
WinChardev *s = WIN_CHARDEV(chr);
int max_size = qemu_chr_be_can_write(chr);
@@ -40,7 +40,7 @@ static void win_chr_read(Chardev *chr, DWORD len)
len = max_size;
}
if (len == 0) {
- return;
+ return 0;
}
ZeroMemory(&s->orecv, sizeof(s->orecv));
@@ -56,6 +56,8 @@ static void win_chr_read(Chardev *chr, DWORD len)
if (size > 0) {
qemu_chr_be_write(chr, buf, size);
}
+
+ return size > 0 ? 1 : 0;
}
static int win_chr_serial_poll(void *opaque)
@@ -67,8 +69,9 @@ static int win_chr_serial_poll(void *opaque)
ClearCommError(s->file, &comerr, &status);
if (status.cbInQue > 0) {
- win_chr_read(chr, status.cbInQue);
- return 1;
+ if (win_chr_read(chr, status.cbInQue)) {
+ return 1;
+ }
}
return 0;
}
@@ -147,8 +150,9 @@ int win_chr_pipe_poll(void *opaque)
PeekNamedPipe(s->file, NULL, 0, NULL, &size, NULL);
if (size > 0) {
- win_chr_read(chr, size);
- return 1;
+ if (win_chr_read(chr, size)) {
+ return 1;
+ }
}
return 0;
}
--
2.50.1 (Apple Git-155)
next prev parent reply other threads:[~2026-04-13 16:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 16:43 [PATCH 0/3] win32: Windows-specific fixes from the mailing list Mohamed Mediouni
2026-04-13 16:43 ` Mohamed Mediouni [this message]
2026-04-15 9:48 ` [PATCH 1/3] serial COM: windows serial COM PollingFunc don't sleep Marc-André Lureau
2026-04-13 16:43 ` [PATCH 2/3] tap-win32: cleanup leaked handles on tap close Mohamed Mediouni
2026-04-13 16:43 ` [PATCH 3/3] tap-win32: allocate separate tap state for each instance Mohamed Mediouni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260413164338.42894-2-mohamed@unpredictable.fr \
--to=mohamed@unpredictable.fr \
--cc=jasowang@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
--cc=werner@carne.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.