Skip to content

Commit

Permalink
8236177: assert(status == 0) failed: error ETIMEDOUT(60), cond_wait
Browse files Browse the repository at this point in the history
Extend the assert to cover the new case.

Reviewed-by: dholmes, kbarrett
  • Loading branch information
Gerard Ziemski committed May 6, 2020
1 parent 1f31afd commit 91ed3fc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/hotspot/os/posix/os_posix.cpp
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/hotspot/share/utilities/macros.hpp
Expand Up @@ -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)
Expand Down

0 comments on commit 91ed3fc

Please sign in to comment.