private void wakeIn ( ) { StateInPipe stateOld ; StateInPipe stateNew ; do { stateOld = _stateInRef . get ( ) ; if ( stateOld . isActive ( ) ) { return ; } stateNew = stateOld . toWake ( ) ; } while ( ! _stateInRef . compareAndSet ( stateOld , stateNew ) ) ; if ( stateOld == StateInPipe . IDLE ) { try ( OutboxAmp outbox = OutboxAmp . currentOrCreate ( _services ) ) { Objects . requireNonNull ( outbox ) ; PipeWakeInMessage < T > msg = new PipeWakeInMessage <> ( outbox , _inRef , this ) ; outbox . offer ( msg ) ; } } }
Notify the reader of available data in the pipe . If the writer is asleep wake it .