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

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 09:01:31 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: Abhina Sree (abhina-sree)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/109823.diff


1 Files Affected:

- (modified) llvm/unittests/Support/TimerTest.cpp (+4) 


``````````diff
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
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/109823


More information about the llvm-commits mailing list