src/main/java/io/reactivex/internal/util/HalfSerializer.java
public static void onComplete(Observer<?> observer, AtomicInteger wip, AtomicThrowable error) {
        if (wip.getAndIncrement() == 0) {
            Throwable ex = error.terminate();
            if (ex != null) {
                observer.onError(ex);
            } else {
                observer.onComplete();
            }
        }
    }
public static void onComplete(Observer<?> observer, AtomicInteger wip, AtomicThrowable error) {
        if (wip.getAndIncrement() == 0) {
            Throwable ex = error.terminate();
            if (ex != null) {
                observer.onError(ex);
            } else {
                observer.onComplete();
            }
        }
    }
public static void onComplete ( Observer < ? > observer , AtomicInteger wip , AtomicThrowable error ) { if ( wip . getAndIncrement ( ) == 0 ) { Throwable ex = error . terminate ( ) ; if ( ex != null ) { observer . onError ( ex ) ; } else { observer . onComplete ( ) ; } } }
Emits an onComplete signal or an onError signal with the given error or indicates
the concurrently running onNext should do that.
@param observer the target Subscriber to emit to
@param wip the serialization work-in-progress counter/indicator
@param error the holder of Throwables
Emits an onComplete signal or an onError signal with the given error or indicates the concurrently running onNext should do that .