Skip to content

Commit 3fdb9ef

Browse files
committed
Make TakeUntil obey Rx contract
1 parent f10fe76 commit 3fdb9ef

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

rxjava-core/src/main/java/rx/internal/operators/OperatorTakeUntil.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,28 @@ public OperatorTakeUntil(final Observable<? extends E> other) {
3535

3636
@Override
3737
public Subscriber<? super T> call(final Subscriber<? super T> child) {
38+
final Object guard = new Object();
3839
final Subscriber<T> parent = new Subscriber<T>(child) {
3940

4041
@Override
4142
public void onCompleted() {
42-
child.onCompleted();
43+
synchronized (guard) {
44+
child.onCompleted();
45+
}
4346
}
4447

4548
@Override
4649
public void onError(Throwable e) {
47-
child.onError(e);
50+
synchronized (guard) {
51+
child.onError(e);
52+
}
4853
}
4954

5055
@Override
5156
public void onNext(T t) {
52-
child.onNext(t);
57+
synchronized (guard) {
58+
child.onNext(t);
59+
}
5360
}
5461

5562
};

0 commit comments

Comments
 (0)