Skip to content

Instantly share code, notes, and snippets.

@Diolor
Created December 1, 2018 02:09
Show Gist options
  • Save Diolor/067fcb0bbe562139fc80b61902694c8d to your computer and use it in GitHub Desktop.
Save Diolor/067fcb0bbe562139fc80b61902694c8d to your computer and use it in GitHub Desktop.
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
.combineLatest(
subject.subscribeOn(io()),
just(Unit).subscribeOn(computation())
) { _, _ ->
Unit
}
.subscribe {
printCurrentThread("subscribe onNext")
}
Thread.sleep(100L)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment