aboutsummaryrefslogtreecommitdiff
path: root/src/os/bsd/vm/os_bsd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/bsd/vm/os_bsd.cpp')
-rw-r--r--src/os/bsd/vm/os_bsd.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/os/bsd/vm/os_bsd.cpp b/src/os/bsd/vm/os_bsd.cpp
index 47e5d16ef..456daba55 100644
--- a/src/os/bsd/vm/os_bsd.cpp
+++ b/src/os/bsd/vm/os_bsd.cpp
@@ -2636,9 +2636,21 @@ int os::sleep(Thread* thread, jlong millis, bool interruptible) {
}
}
-int os::naked_sleep() {
- // %% make the sleep time an integer flag. for now use 1 millisec.
- return os::sleep(Thread::current(), 1, false);
+void os::naked_short_sleep(jlong ms) {
+ struct timespec req;
+
+ assert(ms < 1000, "Un-interruptable sleep, short time use only");
+ req.tv_sec = 0;
+ if (ms > 0) {
+ req.tv_nsec = (ms % 1000) * 1000000;
+ }
+ else {
+ req.tv_nsec = 1;
+ }
+
+ nanosleep(&req, NULL);
+
+ return;
}
// Sleep forever; naked call to OS-specific sleep; use with CAUTION