Join Slack
Powered by
I have a few functions that do some database stuff...
# announcements
w
wouterdoeland
04/27/2017, 4:09 PM
I have a few functions that do some database stuff. Of course I want to run them async, how should I do it? Add the suspend keyword to the function and then call the functions with an async block?
e
elizarov
04/27/2017, 4:13 PM
Please, join
#C1CFAFJSK
for discussion. Assuming that you don’t have access to async DB driver (your DB invocations block at thread) you can consider this kind of solution:
https://github.com/Kotlin/kotlinx.coroutines/blob/master/ui/coroutines-guide-ui.md#blocking-operations
elizarov
04/27/2017, 4:14 PM
Or you can use it from coroutines as-it (without suspend keyword) if you don’t mind your thread to be blocked
👍 1
Open in Slack
Previous
Next