8029453: java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java failed by timeout
authordholmes
Thu, 13 Aug 2015 22:08:40 -0400
changeset 32353 90d7e2214fe5
parent 32350 fec57eb3f599
child 32354 d75120971606
8029453: java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java failed by timeout Reviewed-by: bdelsart, ddmitriev, dcubed
hotspot/src/os/linux/vm/os_linux.cpp
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Thu Aug 13 09:32:01 2015 +0200
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Thu Aug 13 22:08:40 2015 -0400
@@ -5785,9 +5785,11 @@
         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 {