public int addAndGetHi ( int delta ) { while ( true ) { long encoded = get ( ) ; int hi = getHi ( encoded ) + delta ; long update = encodeHi ( encoded , hi ) ; if ( compareAndSet ( encoded , update ) ) return hi ; } }
Atomically adds the given delta to the current hi value returning the updated hi value .