--- a/src/hotspot/os/windows/os_windows.cpp Tue Feb 05 13:21:59 2019 -0500
+++ b/src/hotspot/os/windows/os_windows.cpp Tue Feb 05 15:12:13 2019 -0500
@@ -5277,6 +5277,55 @@
SetEvent(_ParkEvent);
}
+// Platform Monitor implementation
+
+os::PlatformMonitor::PlatformMonitor() {
+ InitializeConditionVariable(&_cond);
+ InitializeCriticalSection(&_mutex);
+}
+
+os::PlatformMonitor::~PlatformMonitor() {
+ DeleteCriticalSection(&_mutex);
+}
+
+void os::PlatformMonitor::lock() {
+ EnterCriticalSection(&_mutex);
+}
+
+void os::PlatformMonitor::unlock() {
+ LeaveCriticalSection(&_mutex);
+}
+
+bool os::PlatformMonitor::try_lock() {
+ return TryEnterCriticalSection(&_mutex);
+}
+
+// Must already be locked
+int os::PlatformMonitor::wait(jlong millis) {
+ assert(millis >= 0, "negative timeout");
+ int ret = OS_TIMEOUT;
+ int status = SleepConditionVariableCS(&_cond, &_mutex,
+ millis == 0 ? INFINITE : millis);
+ if (status != 0) {
+ ret = OS_OK;
+ }
+ #ifndef PRODUCT
+ else {
+ DWORD err = GetLastError();
+ assert(err == ERROR_TIMEOUT, "SleepConditionVariableCS: %ld:", err);
+ }
+ #endif
+ return ret;
+}
+
+void os::PlatformMonitor::notify() {
+ WakeConditionVariable(&_cond);
+}
+
+void os::PlatformMonitor::notify_all() {
+ WakeAllConditionVariable(&_cond);
+}
+
// Run the specified command in a separate process. Return its exit value,
// or -1 on failure (e.g. can't create a new process).
int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {