Skip to content

Commit fba6637

Browse files
committed
[flang] Remove C++ runtime dependency from Sleep extension
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.
1 parent cd683bd commit fba6637

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

flang/runtime/extensions.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ void RTNAME(Sleep)(std::int64_t seconds) {
136136
if (seconds < 1) {
137137
return;
138138
}
139-
std::this_thread::sleep_for(std::chrono::seconds(seconds));
139+
#if _WIN32
140+
Sleep(seconds * 1000);
141+
#else
142+
sleep(seconds);
143+
#endif
140144
}
141145

142146
// TODO: not supported on Windows

0 commit comments

Comments
 (0)