void wakeOut ( ) { OnAvailable outFlow = _outFlow ; if ( outFlow == null ) { return ; } if ( _creditsIn <= _queue . head ( ) ) { return ; } StateOutPipe stateOld ; StateOutPipe stateNew ; do { stateOld = _stateOutRef . get ( ) ; if ( ! stateOld . isFull ( ) ) { return ; } stateNew = stateOld . toWake ( ) ; } while ( ! _stateOutRef . compareAndSet ( stateOld , stateNew ) ) ; try ( OutboxAmp outbox = OutboxAmp . currentOrCreate ( _outRef . services ( ) ) ) { Objects . requireNonNull ( outbox ) ; PipeWakeOutMessage < T > msg = new PipeWakeOutMessage <> ( outbox , _outRef , this , outFlow ) ; outbox . offer ( msg ) ; } }
Notify the reader of available space in the pipe . If the writer is asleep wake it .