From 6b3f9d3d1ada3217b7401925bb86b3399defb235 Mon Sep 17 00:00:00 2001 From: David Holmes Date: Thu, 13 Aug 2015 22:08:40 -0400 Subject: [PATCH] 8029453: java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java failed by timeout Reviewed-by: bdelsart, ddmitriev, dcubed --- hotspot/src/os/linux/vm/os_linux.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index bd4aa14b32f..769665642d9 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -5785,9 +5785,11 @@ void Parker::unpark() { status = pthread_mutex_unlock(_mutex); assert(status == 0, "invariant"); } else { + // must capture correct index before unlocking + int index = _cur_index; status = pthread_mutex_unlock(_mutex); assert(status == 0, "invariant"); - status = pthread_cond_signal(&_cond[_cur_index]); + status = pthread_cond_signal(&_cond[index]); assert(status == 0, "invariant"); } } else {