public static <T> boolean onNext(Subscriber<? super T> subscriber,
      T value,
      AtomicInteger wip,
      AtomicThrowable error) {
    if (wip.get() == 0 && wip.compareAndSet(0, 1)) {
      subscriber.onNext(value);
      if (wip.decrementAndGet() != 0) {
        Throwable ex = error.terminate();
        if (ex != null) {
          subscriber.onError(ex);
        } else {
          subscriber.onComplete();
        }
        return true;
      }
    }
    return false;
  }
public static < T > boolean onNext ( Subscriber < ? super T > subscriber , T value , AtomicInteger wip , AtomicThrowable error ) { if ( wip . get ( ) == 0 && wip . compareAndSet ( 0 , 1 ) ) { subscriber . onNext ( value ) ; if ( wip . decrementAndGet ( ) != 0 ) { Throwable ex = error . terminate ( ) ; if ( ex != null ) { subscriber . onError ( ex ) ; } else { subscriber . onComplete ( ) ; } return true ; } } return false ; }
Emits the given value if possible and terminates if there was an onComplete or onError
while emitting, drops the value otherwise.

@param <T> the value type
@param subscriber the target Subscriber to emit to
@param value the value to emit
@param wip the serialization work-in-progress counter/indicator
@param error the holder of Throwables
@return true if a terminal event was emitted to {@code observer}, false if not