equal
deleted
inserted
replaced
4795 // that it will take two back-to-back park() calls for the owning |
4795 // that it will take two back-to-back park() calls for the owning |
4796 // thread to block. This has the benefit of forcing a spurious return |
4796 // thread to block. This has the benefit of forcing a spurious return |
4797 // from the first park() call after an unpark() call which will help |
4797 // from the first park() call after an unpark() call which will help |
4798 // shake out uses of park() and unpark() without condition variables. |
4798 // shake out uses of park() and unpark() without condition variables. |
4799 |
4799 |
4800 if (Atomic::xchg(1, &_Event) >= 0) return; |
4800 if (Atomic::xchg(&_Event, 1) >= 0) return; |
4801 |
4801 |
4802 // If the thread associated with the event was parked, wake it. |
4802 // If the thread associated with the event was parked, wake it. |
4803 // Wait for the thread assoc with the PlatformEvent to vacate. |
4803 // Wait for the thread assoc with the PlatformEvent to vacate. |
4804 int status = os::Solaris::mutex_lock(_mutex); |
4804 int status = os::Solaris::mutex_lock(_mutex); |
4805 assert_status(status == 0, status, "mutex_lock"); |
4805 assert_status(status == 0, status, "mutex_lock"); |
4894 |
4894 |
4895 // Optional fast-path check: |
4895 // Optional fast-path check: |
4896 // Return immediately if a permit is available. |
4896 // Return immediately if a permit is available. |
4897 // We depend on Atomic::xchg() having full barrier semantics |
4897 // We depend on Atomic::xchg() having full barrier semantics |
4898 // since we are doing a lock-free update to _counter. |
4898 // since we are doing a lock-free update to _counter. |
4899 if (Atomic::xchg(0, &_counter) > 0) return; |
4899 if (Atomic::xchg(&_counter, 0) > 0) return; |
4900 |
4900 |
4901 // Optional fast-exit: Check interrupt before trying to wait |
4901 // Optional fast-exit: Check interrupt before trying to wait |
4902 Thread* thread = Thread::current(); |
4902 Thread* thread = Thread::current(); |
4903 assert(thread->is_Java_thread(), "Must be JavaThread"); |
4903 assert(thread->is_Java_thread(), "Must be JavaThread"); |
4904 JavaThread *jt = (JavaThread *)thread; |
4904 JavaThread *jt = (JavaThread *)thread; |