Created
December 1, 2018 01:55
-
-
Save Diolor/ac72dc656796b0994a5ca8552b5f995d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun printCurrentThread(tag: String) = println("$tag: ${Thread.currentThread().name.substringBefore("-")}") | |
fun main(args: Array<String>) { | |
printCurrentThread("main thread name") | |
val subject = BehaviorSubject.create(Unit) | |
Observable | |
.merge( | |
just(Unit), | |
subject | |
) | |
.subscribeOn(computation()) | |
.subscribe { | |
printCurrentThread("subscribe onNext") | |
} | |
Thread.sleep(100L) | |
subject.onNext(Unit) | |
Thread.sleep(100L) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment