ghedeon
02/01/2019, 11:29 AMMain
. As a result, the whole chain is now on the Main
, which is not obvious, if you look at the declaration.
Ex:
....
.map { single_that_switches_the_thread_to_Main() }
.map {} // <--- NOT io
.subscribeOn(io)
So, I'd like to be able to tell to this single_that_switches_the_thread_to_Main()
to switch to the caller thread, inside of it, not on the usage side.gsala
02/01/2019, 12:26 PMsubscribeOn(io)
?ghedeon
02/01/2019, 12:31 PMsingle_that_switches_the_thread_to_Main()
gsala
02/01/2019, 1:19 PMobserveOn(io)
after the single_...
wouldn't do it because you are not sure the caller thread was io?ghedeon
02/01/2019, 1:26 PMobserveOn(io)
does the trick of course. But it's a fix on the usage side. Let say I'm exposing this single_that_switches_thread
. Now, I need to make sure to tell everybody "hey, warning, it fuck ups your chain, fix it with observeOn!". And then you have this hacks all over the code. I was wondering if it's possible to fix it on the creation side, in the provider of this single itself.rook
02/01/2019, 3:56 PMsingle_that_switches_thread
exposed through a method that takes a “source thread” scheduler and then just call observeOn
for the callerrook
02/01/2019, 3:57 PMsingle_that_switches_thread
without explicitly stating which thread it’s being called fromghedeon
02/01/2019, 4:51 PMrook
02/01/2019, 6:28 PMnewThread
scheduler.ursus
02/02/2019, 9:19 AM