src/hotspot/os/posix/os_posix.inline.hpp
changeset 53886 e94ed0236046
parent 53654 7054249afee5
child 54195 4b6a629d0615
--- a/src/hotspot/os/posix/os_posix.inline.hpp	Fri Feb 22 11:10:55 2019 +0530
+++ b/src/hotspot/os/posix/os_posix.inline.hpp	Fri Feb 22 09:23:37 2019 +0100
@@ -42,6 +42,39 @@
 inline int os::Posix::clock_getres(clockid_t clock_id, struct timespec *tp) {
   return _clock_getres != NULL ? _clock_getres(clock_id, tp) : -1;
 }
+
 #endif // SUPPORTS_CLOCK_MONOTONIC
 
+#ifndef SOLARIS
+
+// Platform Monitor implementation
+
+inline void os::PlatformMonitor::lock() {
+  int status = pthread_mutex_lock(&_mutex);
+  assert_status(status == 0, status, "mutex_lock");
+}
+
+inline void os::PlatformMonitor::unlock() {
+  int status = pthread_mutex_unlock(&_mutex);
+  assert_status(status == 0, status, "mutex_unlock");
+}
+
+inline bool os::PlatformMonitor::try_lock() {
+  int status = pthread_mutex_trylock(&_mutex);
+  assert_status(status == 0 || status == EBUSY, status, "mutex_trylock");
+  return status == 0;
+}
+
+inline void os::PlatformMonitor::notify() {
+  int status = pthread_cond_signal(&_cond);
+  assert_status(status == 0, status, "cond_signal");
+}
+
+inline void os::PlatformMonitor::notify_all() {
+  int status = pthread_cond_broadcast(&_cond);
+  assert_status(status == 0, status, "cond_broadcast");
+}
+
+#endif // !SOLARIS
+
 #endif // OS_POSIX_OS_POSIX_INLINE_HPP