final void cleanStack ( ) { boolean unlinked = false ; Completion p ; while ( ( p = stack ) != null && ! p . isLive ( ) ) // ensure head of stack live unlinked = casStack ( p , p . next ) ; if ( p != null && ! unlinked ) { // try to unlink first nonlive for ( Completion q = p . next ; q != null ; ) { Completion s = q . next ; if ( q . isLive ( ) ) { p = q ; q = s ; } else { casNext ( p , q , s ) ; break ; } } } }
Traverses stack and unlinks one or more dead Completions if found .