Skip to content

Commit

Permalink
ensure waiting tasks are cancelled on worker unsubscription (#3867)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmoten authored and zsxwing committed Apr 20, 2016
1 parent 8af2bc9 commit 3439dd8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/rx/schedulers/ExecutorScheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,17 @@ public void run() {
queue.clear();
return;
}

ScheduledAction sa = queue.poll();
if (sa == null) {
return;
}

if (!sa.isUnsubscribed()) {
sa.run();
if (!tasks.isUnsubscribed()) {
sa.run();
} else {
queue.clear();
return;
}
}
} while (wip.decrementAndGet() != 0);
}
Expand Down

0 comments on commit 3439dd8

Please sign in to comment.