Mercurial > hg > graal-compiler
comparison src/os/linux/vm/os_linux.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 | 354d3184f6b2 |
children | 167c2986d91b |
comparison
equal
deleted
inserted
replaced
1115:4b966d9946a3 | 1117:95e9083cf4a7 |
---|---|
4681 void Parker::park(bool isAbsolute, jlong time) { | 4681 void Parker::park(bool isAbsolute, jlong time) { |
4682 // Optional fast-path check: | 4682 // Optional fast-path check: |
4683 // Return immediately if a permit is available. | 4683 // Return immediately if a permit is available. |
4684 if (_counter > 0) { | 4684 if (_counter > 0) { |
4685 _counter = 0 ; | 4685 _counter = 0 ; |
4686 OrderAccess::fence(); | |
4686 return ; | 4687 return ; |
4687 } | 4688 } |
4688 | 4689 |
4689 Thread* thread = Thread::current(); | 4690 Thread* thread = Thread::current(); |
4690 assert(thread->is_Java_thread(), "Must be JavaThread"); | 4691 assert(thread->is_Java_thread(), "Must be JavaThread"); |
4723 int status ; | 4724 int status ; |
4724 if (_counter > 0) { // no wait needed | 4725 if (_counter > 0) { // no wait needed |
4725 _counter = 0; | 4726 _counter = 0; |
4726 status = pthread_mutex_unlock(_mutex); | 4727 status = pthread_mutex_unlock(_mutex); |
4727 assert (status == 0, "invariant") ; | 4728 assert (status == 0, "invariant") ; |
4729 OrderAccess::fence(); | |
4728 return; | 4730 return; |
4729 } | 4731 } |
4730 | 4732 |
4731 #ifdef ASSERT | 4733 #ifdef ASSERT |
4732 // Don't catch signals while blocked; let the running threads have the signals. | 4734 // Don't catch signals while blocked; let the running threads have the signals. |
4763 // If externally suspended while waiting, re-suspend | 4765 // If externally suspended while waiting, re-suspend |
4764 if (jt->handle_special_suspend_equivalent_condition()) { | 4766 if (jt->handle_special_suspend_equivalent_condition()) { |
4765 jt->java_suspend_self(); | 4767 jt->java_suspend_self(); |
4766 } | 4768 } |
4767 | 4769 |
4770 OrderAccess::fence(); | |
4768 } | 4771 } |
4769 | 4772 |
4770 void Parker::unpark() { | 4773 void Parker::unpark() { |
4771 int s, status ; | 4774 int s, status ; |
4772 status = pthread_mutex_lock(_mutex); | 4775 status = pthread_mutex_lock(_mutex); |