[llvm] [SystemZ][z/OS] z/OS does not support nanosleep, use usleep instead (PR #109823)
Abhina Sree via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 09:00:54 PDT 2024
https://github.com/abhina-sree created https://github.com/llvm/llvm-project/pull/109823
Use usleep instead of nanosleep to resolve a build error on z/OS because there is no support for nanosleep.
>From bc5b97cefdf598a1fc264df74f602c4dba2b393d Mon Sep 17 00:00:00 2001
From: Abhina Sreeskantharajan <Abhina.Sreeskantharajan at ibm.com>
Date: Tue, 24 Sep 2024 11:59:58 -0400
Subject: [PATCH] [SystemZ][z/OS] z/OS does not support nanosleep, use usleep
instead
---
llvm/unittests/Support/TimerTest.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/llvm/unittests/Support/TimerTest.cpp b/llvm/unittests/Support/TimerTest.cpp
index 09545eb6939aeb..30f9f132a8d15a 100644
--- a/llvm/unittests/Support/TimerTest.cpp
+++ b/llvm/unittests/Support/TimerTest.cpp
@@ -27,6 +27,10 @@ void SleepMS() {
struct timespec Interval;
Interval.tv_sec = 0;
Interval.tv_nsec = 1000000;
+#if defined(__MVS__)
+ long Microseconds = (Interval.tv_nsec + 999) / 1000;
+ usleep(Microseconds);
+#else
nanosleep(&Interval, nullptr);
#endif
}
More information about the llvm-commits
mailing list