I have PublishSubject for observing status change and also I have method with multiple steps, which I execute in another thread. How I can force stop this thread when subject received changes?
Asked
Active
Viewed 128 times
1 Answers
0
In spite of stopping a thread, you can stop emitting new elements and release resources of your PublishSubject. Inside your PublishSubject add a check for isDisposed and if it is true - stop emitting and call onCompleted. From your code dispose of your PublishSubject. I hope it'll help.

Peter Staranchuk
- 1,343
- 3
- 14
- 29