[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 11:08:37 PDT 2024


https://github.com/abhina-sree updated https://github.com/llvm/llvm-project/pull/109823

>From b696fbed8f4039f50f235f6e56c3ccebf40dd151 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 | 5 +++++
 1 file changed, 5 insertions(+)

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