-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[flang] Remove C++ runtime dependency from Sleep extension #84911
Conversation
@llvm/pr-subscribers-flang-runtime Author: David Truby (DavidTruby) ChangesThe Sleep extension currently has a potential dependency on the C++ runtime. I Full diff: https://github.com/llvm/llvm-project/pull/84911.diff 1 Files Affected:
diff --git a/flang/runtime/extensions.cpp b/flang/runtime/extensions.cpp
index 3ac98000335d7d..fb11e792f613f5 100644
--- a/flang/runtime/extensions.cpp
+++ b/flang/runtime/extensions.cpp
@@ -135,7 +135,11 @@ void RTNAME(Sleep)(std::int64_t seconds) {
if (seconds < 1) {
return;
}
- std::this_thread::sleep_for(std::chrono::seconds(seconds));
+#if _WIN32
+ Sleep(seconds * 1000);
+#else
+ sleep(seconds);
+#endif
}
} // namespace Fortran::runtime
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
✅ With the latest revision this PR passed the C/C++ code formatter. |
The Sleep extension currently has a potential dependency on the C++ runtime. I run into this dependency using libc++ on Linux. This patch uses the POSIX `sleep` function or the Windows `Sleep` function instead to avoid this dependency.
The Sleep extension currently has a potential dependency on the C++ runtime. I
run into this dependency using libc++ on Linux. This patch uses the POSIX
sleep
function or the WindowsSleep
function instead to avoid thisdependency.