src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp
changeset 59252 623722a6aeb9
parent 58863 c16ac7a2eba4
equal deleted inserted replaced
59251:4cbfa5077d68 59252:623722a6aeb9
    91 
    91 
    92 static volatile int _lock = 0;
    92 static volatile int _lock = 0;
    93 
    93 
    94 ObjectSampler* ObjectSampler::acquire() {
    94 ObjectSampler* ObjectSampler::acquire() {
    95   assert(is_created(), "invariant");
    95   assert(is_created(), "invariant");
    96   while (Atomic::cmpxchg(1, &_lock, 0) == 1) {}
    96   while (Atomic::cmpxchg(&_lock, 0, 1) == 1) {}
    97   return _instance;
    97   return _instance;
    98 }
    98 }
    99 
    99 
   100 void ObjectSampler::release() {
   100 void ObjectSampler::release() {
   101   assert(is_created(), "invariant");
   101   assert(is_created(), "invariant");