Revert "windows: Don't flood windows message queue with gpui messages" (#41803)

Reverts zed-industries/zed#41595

Closes #41704
This commit is contained in:
Lukas Wirth
2025-11-03 10:41:53 +00:00
committed by GitHub
parent 3a058138c1
commit bc3c88e737
+7 -19
View File
@@ -80,27 +80,15 @@ impl PlatformDispatcher for WindowsDispatcher {
} }
fn dispatch_on_main_thread(&self, runnable: Runnable) { fn dispatch_on_main_thread(&self, runnable: Runnable) {
let was_empty = self.main_sender.is_empty();
match self.main_sender.send(runnable) { match self.main_sender.send(runnable) {
Ok(_) => unsafe { Ok(_) => unsafe {
// Only send a `WM_GPUI_TASK_DISPATCHED_ON_MAIN_THREAD` to the PostMessageW(
// queue if we have no runnables queued up yet, otherwise we Some(self.platform_window_handle.as_raw()),
// risk filling the message queue with gpui messages causing us WM_GPUI_TASK_DISPATCHED_ON_MAIN_THREAD,
// to starve the message loop of system messages, resulting in a WPARAM(self.validation_number),
// process hang. LPARAM(0),
// )
// When the message loop receives a .log_err();
// `WM_GPUI_TASK_DISPATCHED_ON_MAIN_THREAD` message we drain the
// runnable queue entirely.
if was_empty {
PostMessageW(
Some(self.platform_window_handle.as_raw()),
WM_GPUI_TASK_DISPATCHED_ON_MAIN_THREAD,
WPARAM(self.validation_number),
LPARAM(0),
)
.log_err();
}
}, },
Err(runnable) => { Err(runnable) => {
// NOTE: Runnable may wrap a Future that is !Send. // NOTE: Runnable may wrap a Future that is !Send.