hotspot/src/share/vm/runtime/synchronizer.cpp
changeset 25477 7dad9f95fd31
parent 25472 381638db28e6
child 25633 4cd9c4622c8c
equal deleted inserted replaced
25476:b97716c4b5c9 25477:7dad9f95fd31
   447     // TODO: restrict the aggregate number of spinners.
   447     // TODO: restrict the aggregate number of spinners.
   448 
   448 
   449     ++its;
   449     ++its;
   450     if (its > 10000 || !os::is_MP()) {
   450     if (its > 10000 || !os::is_MP()) {
   451        if (its & 1) {
   451        if (its & 1) {
   452          os::NakedYield();
   452          os::naked_yield();
   453          TEVENT(Inflate: INFLATING - yield);
   453          TEVENT(Inflate: INFLATING - yield);
   454        } else {
   454        } else {
   455          // Note that the following code attenuates the livelock problem but is not
   455          // Note that the following code attenuates the livelock problem but is not
   456          // a complete remedy.  A more complete solution would require that the inflating
   456          // a complete remedy.  A more complete solution would require that the inflating
   457          // thread hold the associated inflation lock.  The following code simply restricts
   457          // thread hold the associated inflation lock.  The following code simply restricts
   477            // so we periodically call Self->_ParkEvent->park(1).
   477            // so we periodically call Self->_ParkEvent->park(1).
   478            // We use a mixed spin/yield/block mechanism.
   478            // We use a mixed spin/yield/block mechanism.
   479            if ((YieldThenBlock++) >= 16) {
   479            if ((YieldThenBlock++) >= 16) {
   480               Thread::current()->_ParkEvent->park(1);
   480               Thread::current()->_ParkEvent->park(1);
   481            } else {
   481            } else {
   482               os::NakedYield();
   482               os::naked_yield();
   483            }
   483            }
   484          }
   484          }
   485          Thread::muxRelease(InflationLocks + ix);
   485          Thread::muxRelease(InflationLocks + ix);
   486          TEVENT(Inflate: INFLATING - yield/park);
   486          TEVENT(Inflate: INFLATING - yield/park);
   487        }
   487        }