[llvm] 1e67e4b - [SystemZ][z/OS] z/OS does not support nanosleep, use usleep instead (#109823)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 25 05:21:34 PDT 2024


Author: Abhina Sree
Date: 2024-09-25T08:21:29-04:00
New Revision: 1e67e4bbba2a90ecaf5340acef110972413e3e5b

URL: https://github.com/llvm/llvm-project/commit/1e67e4bbba2a90ecaf5340acef110972413e3e5b
DIFF: https://github.com/llvm/llvm-project/commit/1e67e4bbba2a90ecaf5340acef110972413e3e5b.diff

LOG: [SystemZ][z/OS] z/OS does not support nanosleep, use usleep instead (#109823)

Use usleep instead of nanosleep to resolve a build error on z/OS because
there is no support for nanosleep.

Added: 
    

Modified: 
    llvm/unittests/Support/TimerTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Support/TimerTest.cpp b/llvm/unittests/Support/TimerTest.cpp
index 09545eb6939aeb..5686b394e16cdd 100644
--- a/llvm/unittests/Support/TimerTest.cpp
+++ b/llvm/unittests/Support/TimerTest.cpp
@@ -27,8 +27,13 @@ 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
+#endif
 }
 
 TEST(Timer, Additivity) {


        


More information about the llvm-commits mailing list