Reduks icon indicating copy to clipboard operation
Reduks copied to clipboard

How do I configure threading

Open dawidcxx opened this issue 8 years ago • 7 comments

Can I configure .subscribe to be only exectued on a specific thread?

dawidcxx avatar Jun 12 '17 17:06 dawidcxx

Hi, Yes you can. Currently your options are using KovenantStore or RxStore, which by default will always run the subscriber notifications on the Android UI thread, but you can easily modify it. What is your use case?

beyondeye avatar Jun 13 '17 08:06 beyondeye

What is your use case?

I've been thinking about using this library for my JavaFX global shared state.

dawidcxx avatar Jun 13 '17 08:06 dawidcxx

So you need to subscribe for updates on JavaFX Ui thread?

beyondeye avatar Jun 13 '17 10:06 beyondeye

I have some experimental coroutine based asynchronous store that would probably be easiest to modify for your use case. Using coroutine based code (still experimental in kotlin) is an option for you?

beyondeye avatar Jun 13 '17 10:06 beyondeye

@beyondeye

So you need to subscribe for updates on JavaFX Ui thread?

yes, exactly

Using coroutine based code (still experimental in kotlin) is an option for you?

I don't mind.

dawidcxx avatar Jun 13 '17 13:06 dawidcxx

Ok, so use 3.0.0b1 release and use AsyncStore. add dependency from kotlinx-coroutines-javafx

    compile "org.jetbrains.kotlinx:kotlinx-coroutines-javafx:<kotlin_coroutines_version>"

Currently I am using <kotlin_coroutines_version>=0.16 use subscribeContext=JavaFx as argument for AsyncStore constructor. Take a look also to Guide to UI programming with coroutines for more details

beyondeye avatar Jun 14 '17 07:06 beyondeye

don't close this issue. Let us keep it up for reference

beyondeye avatar Jun 14 '17 07:06 beyondeye