Skip to content

Commit 0005db1

Browse files
committed
Merge pull request #2939 from akarnokd/OperatorPublishFix0508
publish: Fix another race between terminalEvent and the queue being empty.
2 parents 0eeee27 + 419dc0f commit 0005db1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/rx/internal/operators/OperatorPublish.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,10 +535,11 @@ void dispatch() {
535535
// may contain less than requested
536536
int d = 0;
537537
while (d < maxRequested) {
538+
term = terminalEvent;
538539
Object v = queue.poll();
539540
empty = v == null;
540541
// let's check if there is a terminal event and the queue became empty just now
541-
if (checkTerminated(terminalEvent, empty)) {
542+
if (checkTerminated(term, empty)) {
542543
skipFinal = true;
543544
return;
544545
}

0 commit comments

Comments
 (0)