[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:04:32 PDT 2024


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

>From 310f0b8eebf8a2e416c4baa40c3ec26b02cc49c1 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