< prev index next > src/hotspot/share/runtime/thread.cpp
Print this page
//
// We employ a spin lock _only for low-contention, fixed-length
// short-duration critical sections where we're concerned
// about native mutex_t or HotSpot Mutex:: latency.
+ bool Thread::TrySpinAcquire(volatile int * adr) {
+ return AtomicAccess::cmpxchg(adr, 0, 1) == 0;
+ }
+
void Thread::SpinAcquire(volatile int * adr) {
if (AtomicAccess::cmpxchg(adr, 0, 1) == 0) {
return; // normal fast-path return
}
< prev index next >