util/main-loop: Fix maximum number of wait objects for win32
The maximum number of wait objects for win32 should be MAXIMUM_WAIT_OBJECTS, not MAXIMUM_WAIT_OBJECTS + 1. Signed-off-by: Bin Meng <bin.meng@windriver.com> Message-Id: <20221019102015.2441622-1-bmeng.cn@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
6295a58ad1
commit
4f76b3d9bb
|
@ -363,10 +363,10 @@ void qemu_del_polling_cb(PollingFunc *func, void *opaque)
|
||||||
/* Wait objects support */
|
/* Wait objects support */
|
||||||
typedef struct WaitObjects {
|
typedef struct WaitObjects {
|
||||||
int num;
|
int num;
|
||||||
int revents[MAXIMUM_WAIT_OBJECTS + 1];
|
int revents[MAXIMUM_WAIT_OBJECTS];
|
||||||
HANDLE events[MAXIMUM_WAIT_OBJECTS + 1];
|
HANDLE events[MAXIMUM_WAIT_OBJECTS];
|
||||||
WaitObjectFunc *func[MAXIMUM_WAIT_OBJECTS + 1];
|
WaitObjectFunc *func[MAXIMUM_WAIT_OBJECTS];
|
||||||
void *opaque[MAXIMUM_WAIT_OBJECTS + 1];
|
void *opaque[MAXIMUM_WAIT_OBJECTS];
|
||||||
} WaitObjects;
|
} WaitObjects;
|
||||||
|
|
||||||
static WaitObjects wait_objects = {0};
|
static WaitObjects wait_objects = {0};
|
||||||
|
@ -395,7 +395,7 @@ void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque)
|
||||||
if (w->events[i] == handle) {
|
if (w->events[i] == handle) {
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
if (found) {
|
if (found && i < (MAXIMUM_WAIT_OBJECTS - 1)) {
|
||||||
w->events[i] = w->events[i + 1];
|
w->events[i] = w->events[i + 1];
|
||||||
w->func[i] = w->func[i + 1];
|
w->func[i] = w->func[i + 1];
|
||||||
w->opaque[i] = w->opaque[i + 1];
|
w->opaque[i] = w->opaque[i + 1];
|
||||||
|
|
Loading…
Reference in New Issue