From 91ed3fc599583270d180c44efc3f1793dfa69325 Mon Sep 17 00:00:00 2001 From: Gerard Ziemski Date: Wed, 6 May 2020 12:42:28 -0500 Subject: [PATCH] 8236177: assert(status == 0) failed: error ETIMEDOUT(60), cond_wait Extend the assert to cover the new case. Reviewed-by: dholmes, kbarrett --- src/hotspot/os/posix/os_posix.cpp | 9 ++++++--- src/hotspot/share/utilities/macros.hpp | 8 ++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/hotspot/os/posix/os_posix.cpp b/src/hotspot/os/posix/os_posix.cpp index 5f470ce2adb..08c303a8787 100644 --- a/src/hotspot/os/posix/os_posix.cpp +++ b/src/hotspot/os/posix/os_posix.cpp @@ -1967,7 +1967,8 @@ void os::PlatformEvent::park() { // AKA "down()" while (_event < 0) { // OS-level "spurious wakeups" are ignored status = pthread_cond_wait(_cond, _mutex); - assert_status(status == 0, status, "cond_wait"); + assert_status(status == 0 MACOS_ONLY(|| status == ETIMEDOUT), + status, "cond_wait"); } --_nParked; @@ -2158,7 +2159,8 @@ void Parker::park(bool isAbsolute, jlong time) { if (time == 0) { _cur_index = REL_INDEX; // arbitrary choice when not timed status = pthread_cond_wait(&_cond[_cur_index], _mutex); - assert_status(status == 0, status, "cond_timedwait"); + assert_status(status == 0 MACOS_ONLY(|| status == ETIMEDOUT), + status, "cond_wait"); } else { _cur_index = isAbsolute ? ABS_INDEX : REL_INDEX; @@ -2339,7 +2341,8 @@ int os::PlatformMonitor::wait(jlong millis) { return ret; } else { int status = pthread_cond_wait(cond(), mutex()); - assert_status(status == 0, status, "cond_wait"); + assert_status(status == 0 MACOS_ONLY(|| status == ETIMEDOUT), + status, "cond_wait"); return OS_OK; } } diff --git a/src/hotspot/share/utilities/macros.hpp b/src/hotspot/share/utilities/macros.hpp index 89195330550..b5df488ea5c 100644 --- a/src/hotspot/share/utilities/macros.hpp +++ b/src/hotspot/share/utilities/macros.hpp @@ -404,6 +404,14 @@ #define NOT_LINUX(code) code #endif +#ifdef __APPLE__ +#define MACOS_ONLY(code) code +#define NOT_MACOS(code) +#else +#define MACOS_ONLY(code) +#define NOT_MACOS(code) code +#endif + #ifdef AIX #define AIX_ONLY(code) code #define NOT_AIX(code)