mirror of
https://github.com/isar/libmdbx.git
synced 2025-06-06 17:32:37 +08:00
mdbx-test: minor refine actor_poll() for Windows.
Change-Id: Ic1d98ae9e6d8bd7534390b15682f0bc7d1e73fac
This commit is contained in:
parent
23733bf4af
commit
3ce4c3a0e4
@ -380,37 +380,38 @@ int osal_actor_poll(mdbx_pid_t &pid, unsigned timeout) {
|
|||||||
if (pair.second.second <= as_running)
|
if (pair.second.second <= as_running)
|
||||||
handles.push_back(pair.second.first);
|
handles.push_back(pair.second.first);
|
||||||
|
|
||||||
loop:
|
while (true) {
|
||||||
DWORD rc =
|
DWORD rc =
|
||||||
MsgWaitForMultipleObjectsEx((DWORD)handles.size(), &handles[0],
|
MsgWaitForMultipleObjectsEx((DWORD)handles.size(), &handles[0],
|
||||||
(timeout > 60) ? 60 * 1000 : timeout * 1000,
|
(timeout > 60) ? 60 * 1000 : timeout * 1000,
|
||||||
QS_ALLINPUT | QS_ALLPOSTMESSAGE, 0);
|
QS_ALLINPUT | QS_ALLPOSTMESSAGE, 0);
|
||||||
|
|
||||||
if (rc == WAIT_OBJECT_0) {
|
if (rc == WAIT_OBJECT_0) {
|
||||||
logging::progress_canary(true);
|
logging::progress_canary(true);
|
||||||
goto loop;
|
continue;
|
||||||
}
|
}
|
||||||
if (rc == WAIT_OBJECT_0 + 1) {
|
if (rc == WAIT_OBJECT_0 + 1) {
|
||||||
logging::progress_canary(false);
|
logging::progress_canary(false);
|
||||||
goto loop;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc >= WAIT_OBJECT_0 + 2 && rc < WAIT_OBJECT_0 + handles.size()) {
|
if (rc >= WAIT_OBJECT_0 + 2 && rc < WAIT_OBJECT_0 + handles.size()) {
|
||||||
pid = 0;
|
pid = 0;
|
||||||
for (const auto &pair : childs)
|
for (const auto &pair : childs)
|
||||||
if (pair.second.first == handles[rc - WAIT_OBJECT_0]) {
|
if (pair.second.first == handles[rc - WAIT_OBJECT_0]) {
|
||||||
pid = pair.first;
|
pid = pair.first;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc == WAIT_TIMEOUT) {
|
if (rc == WAIT_TIMEOUT) {
|
||||||
pid = 0;
|
pid = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return waitstatus2errcode(rc);
|
return waitstatus2errcode(rc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void osal_yield(void) { SwitchToThread(); }
|
void osal_yield(void) { SwitchToThread(); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user