mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:56:38 +00:00
serial COM: windows serial COM PollingFunc don't sleep
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1802 Signed-off-by: Werner de Carne <werner@carne.de> [ Marc-André - indentation fixes ] Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20230807201443.2668-1-werner@carne.de>
This commit is contained in:
committed by
Marc-André Lureau
parent
52cf667ed2
commit
7437b3eab6
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user