src/hotspot/share/utilities/concurrentHashTable.inline.hpp
changeset 59252 623722a6aeb9
parent 59247 56bf71d64d51
equal deleted inserted replaced
59251:4cbfa5077d68 59252:623722a6aeb9
   143                     )
   143                     )
   144 {
   144 {
   145   if (is_locked()) {
   145   if (is_locked()) {
   146     return false;
   146     return false;
   147   }
   147   }
   148   if (Atomic::cmpxchg(node, &_first, expect) == expect) {
   148   if (Atomic::cmpxchg(&_first, expect, node) == expect) {
   149     return true;
   149     return true;
   150   }
   150   }
   151   return false;
   151   return false;
   152 }
   152 }
   153 
   153 
   158   if (is_locked()) {
   158   if (is_locked()) {
   159     return false;
   159     return false;
   160   }
   160   }
   161   // We will expect a clean first pointer.
   161   // We will expect a clean first pointer.
   162   Node* tmp = first();
   162   Node* tmp = first();
   163   if (Atomic::cmpxchg(set_state(tmp, STATE_LOCK_BIT), &_first, tmp) == tmp) {
   163   if (Atomic::cmpxchg(&_first, tmp, set_state(tmp, STATE_LOCK_BIT)) == tmp) {
   164     return true;
   164     return true;
   165   }
   165   }
   166   return false;
   166   return false;
   167 }
   167 }
   168 
   168