Skip to content

Commit e0a75d5

Browse files
committed
LibCore: Implement polling for events on Windows
1 parent 2fd424c commit e0a75d5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Libraries/LibCore/EventLoopImplementationWindows.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ int EventLoopImplementationWindows::exec()
9393
VERIFY_NOT_REACHED();
9494
}
9595

96-
size_t EventLoopImplementationWindows::pump(PumpMode)
96+
size_t EventLoopImplementationWindows::pump(PumpMode pump_mode)
9797
{
9898
auto& event_queue = ThreadEventQueue::current();
9999
auto* thread_data = ThreadData::the();
@@ -115,7 +115,9 @@ size_t EventLoopImplementationWindows::pump(PumpMode)
115115
event_handles.append(entry.key.handle);
116116

117117
bool has_pending_events = event_queue.has_pending_events();
118-
int timeout = has_pending_events ? 0 : INFINITE;
118+
DWORD timeout = 0;
119+
if (!has_pending_events && pump_mode == PumpMode::WaitForEvents)
120+
timeout = INFINITE;
119121
DWORD result = WaitForMultipleObjects(event_count, event_handles.data(), FALSE, timeout);
120122
if (result == WAIT_TIMEOUT) {
121123
// FIXME: This verification sometimes fails with ERROR_INVALID_HANDLE, but when I check

0 commit comments

Comments
 (0)