final void cleanStack ( ) { for ( Completion p = null , q = stack ; q != null ; ) { Completion s = q . next ; if ( q . isLive ( ) ) { p = q ; q = s ; } else if ( p == null ) { casStack ( q , s ) ; q = stack ; } else { p . next = s ; if ( p . isLive ( ) ) q = s ; else { p = null ; // restart q = stack ; } } } }
Traverses stack and unlinks dead Completions .