Mercurial > hg > graal-jvmci-8
comparison src/os/solaris/vm/os_solaris.cpp @ 1117:95e9083cf4a7
6822370: ReentrantReadWriteLock: threads hung when there are no threads holding onto the lock (Netra x4450)
Summary: This day one bug is caused by missing memory barriers in various Parker::park() paths that can result in lost wakeups and hangs.
Reviewed-by: dice, acorn
author | dholmes |
---|---|
date | Tue, 01 Dec 2009 22:29:02 -0500 |
parents | 665be97e8704 |
children | 167c2986d91b |
comparison
equal
deleted
inserted
replaced
1115:4b966d9946a3 | 1117:95e9083cf4a7 |
---|---|
5801 | 5801 |
5802 // Optional fast-path check: | 5802 // Optional fast-path check: |
5803 // Return immediately if a permit is available. | 5803 // Return immediately if a permit is available. |
5804 if (_counter > 0) { | 5804 if (_counter > 0) { |
5805 _counter = 0 ; | 5805 _counter = 0 ; |
5806 OrderAccess::fence(); | |
5806 return ; | 5807 return ; |
5807 } | 5808 } |
5808 | 5809 |
5809 // Optional fast-exit: Check interrupt before trying to wait | 5810 // Optional fast-exit: Check interrupt before trying to wait |
5810 Thread* thread = Thread::current(); | 5811 Thread* thread = Thread::current(); |
5844 | 5845 |
5845 if (_counter > 0) { // no wait needed | 5846 if (_counter > 0) { // no wait needed |
5846 _counter = 0; | 5847 _counter = 0; |
5847 status = os::Solaris::mutex_unlock(_mutex); | 5848 status = os::Solaris::mutex_unlock(_mutex); |
5848 assert (status == 0, "invariant") ; | 5849 assert (status == 0, "invariant") ; |
5850 OrderAccess::fence(); | |
5849 return; | 5851 return; |
5850 } | 5852 } |
5851 | 5853 |
5852 #ifdef ASSERT | 5854 #ifdef ASSERT |
5853 // Don't catch signals while blocked; let the running threads have the signals. | 5855 // Don't catch signals while blocked; let the running threads have the signals. |
5890 // If externally suspended while waiting, re-suspend | 5892 // If externally suspended while waiting, re-suspend |
5891 if (jt->handle_special_suspend_equivalent_condition()) { | 5893 if (jt->handle_special_suspend_equivalent_condition()) { |
5892 jt->java_suspend_self(); | 5894 jt->java_suspend_self(); |
5893 } | 5895 } |
5894 | 5896 |
5897 OrderAccess::fence(); | |
5895 } | 5898 } |
5896 | 5899 |
5897 void Parker::unpark() { | 5900 void Parker::unpark() { |
5898 int s, status ; | 5901 int s, status ; |
5899 status = os::Solaris::mutex_lock (_mutex) ; | 5902 status = os::Solaris::mutex_lock (_mutex) ; |