https://kotlinlang.org logo
#coroutines
Title
# coroutines
u

uli

04/02/2017, 9:05 PM
What would be your suspending function then? I would say putting runBlocking around non suspending code is a noop. What are you trying to achieve?
i

Ian

04/02/2017, 10:50 PM
This is for http://kweb.io/, you can see an example of how I’m using
future
in the source snippet on that page.
u

uli

04/03/2017, 5:11 AM
I suggest to use launch(CommonPool) if you don't need a result.For the exception I am not sure, what you would like to happen in case of exception.
I think future will leak memory if you don't call await as the result is being kept until collected by await. Even if the result is Unit Well I guess, when the future get's collected, then the result will also go away. Nut sure though.
i

Ian

04/03/2017, 8:37 PM
Uli, I would like exceptions to be logged by my library, but the problem is that the
future
declaration occurs in the user of my library’s code - so really I’m looking for a recommendation to my users that will allow them to synchronously wait on futures, but without losing exceptions that might be thrown in that code.
3 Views