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); |