Skip to content

[lldb] Fix premature MainLoop wakeup on windows #117756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2024
Merged

Conversation

labath
Copy link
Collaborator

@labath labath commented Nov 26, 2024

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

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

llvmbot commented Nov 26, 2024

@llvm/pr-subscribers-lldb

Author: Pavel Labath (labath)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/117756.diff

1 Files Affected:

  • (modified) lldb/source/Host/windows/MainLoopWindows.cpp (+1-1)
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() {

@labath
Copy link
Collaborator Author

labath commented Nov 26, 2024

(I haven't tested it, but I'm fairly certain it should fix the problem in #112895 (comment))

Copy link
Collaborator

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

I'll keep an eye on the buildbot.

@DavidSpickett DavidSpickett merged commit 17b8785 into llvm:main Nov 27, 2024
9 checks passed
@labath labath deleted the clock branch November 27, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants