[Lldb-commits] [lldb] [lldb] Fix premature MainLoop wakeup on windows (PR #117756)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 26 10:13:47 PST 2024


https://github.com/labath created https://github.com/llvm/llvm-project/pull/117756

The windows system APIs only take milliseconds. Make sure we round the sleep interval (in nanoseconds) upwards.

>From 153338ddae6f6442ffbe195a98e27e812a3f3ed6 Mon Sep 17 00:00:00 2001
From: Pavel Labath <pavel at labath.sk>
Date: Tue, 26 Nov 2024 19:11:17 +0100
Subject: [PATCH] [lldb] Fix premature MainLoop wakeup on windows

The windows system APIs only take milliseconds. Make sure we round the
sleep interval (in nanoseconds) upwards.
---
 lldb/source/Host/windows/MainLoopWindows.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Host/windows/MainLoopWindows.cpp b/lldb/source/Host/windows/MainLoopWindows.cpp
index 0a5a35e9db9dde..f3ab2a710cd014 100644
--- a/lldb/source/Host/windows/MainLoopWindows.cpp
+++ b/lldb/source/Host/windows/MainLoopWindows.cpp
@@ -28,7 +28,7 @@ static DWORD ToTimeout(std::optional<MainLoopWindows::TimePoint> point) {
     return WSA_INFINITE;
 
   nanoseconds dur = (std::max)(*point - steady_clock::now(), nanoseconds(0));
-  return duration_cast<milliseconds>(dur).count();
+  return ceil<milliseconds>(dur).count();
 }
 
 MainLoopWindows::MainLoopWindows() {



More information about the lldb-commits mailing list