src/hotspot/share/runtime/mutex.cpp
changeset 48488 51825789dd89
parent 47881 0ce0ac68ace7
child 49449 ef5d5d343e2a
equal deleted inserted replaced
48487:abf1d797e380 48488:51825789dd89
   465   // LockWord encoding = (cxq,LOCKBYTE)
   465   // LockWord encoding = (cxq,LOCKBYTE)
   466   ESelf->reset();
   466   ESelf->reset();
   467   OrderAccess::fence();
   467   OrderAccess::fence();
   468 
   468 
   469   // Optional optimization ... try barging on the inner lock
   469   // Optional optimization ... try barging on the inner lock
   470   if ((NativeMonitorFlags & 32) && Atomic::cmpxchg(ESelf, &_OnDeck, (ParkEvent*)NULL) == NULL) {
   470   if ((NativeMonitorFlags & 32) && Atomic::replace_if_null(ESelf, &_OnDeck)) {
   471     goto OnDeck_LOOP;
   471     goto OnDeck_LOOP;
   472   }
   472   }
   473 
   473 
   474   if (AcquireOrPush(ESelf)) goto Exeunt;
   474   if (AcquireOrPush(ESelf)) goto Exeunt;
   475 
   475 
   572   // but only one concurrent consumer (detacher of RATs).
   572   // but only one concurrent consumer (detacher of RATs).
   573   // Consider protecting this critical section with schedctl on Solaris.
   573   // Consider protecting this critical section with schedctl on Solaris.
   574   // Unlike a normal lock, however, the exiting thread "locks" OnDeck,
   574   // Unlike a normal lock, however, the exiting thread "locks" OnDeck,
   575   // picks a successor and marks that thread as OnDeck.  That successor
   575   // picks a successor and marks that thread as OnDeck.  That successor
   576   // thread will then clear OnDeck once it eventually acquires the outer lock.
   576   // thread will then clear OnDeck once it eventually acquires the outer lock.
   577   if (Atomic::cmpxchg((ParkEvent*)_LBIT, &_OnDeck, (ParkEvent*)NULL) != NULL) {
   577   if (!Atomic::replace_if_null((ParkEvent*)_LBIT, &_OnDeck)) {
   578     return;
   578     return;
   579   }
   579   }
   580 
   580 
   581   ParkEvent * List = _EntryList;
   581   ParkEvent * List = _EntryList;
   582   if (List != NULL) {
   582   if (List != NULL) {