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

rrader

02/02/2017, 2:48 PM
Is it possible somehow with Kotlin coroutines to do a behaviour like: a request(r1) comes to server, this request is handled in a thread from thread pool, server does some work in that thread, after this server make a request to remote server, at this moment this thread should be returned to thread pool to handle another request(r2), after remote server returned a response, request(r1) should continue work from moment when was made a remote request
e

elizarov

02/02/2017, 3:35 PM
rrader: That's the primary use-case for coroutines (that is, that is exactly what they were designed for)
r

rrader

02/02/2017, 3:40 PM
it is a bit hard to understand how it should be, I see something like https://gist.github.com/anonymous/00c645a313c854d784186fb0da85b829 can you supply some examples how to make that I described?
e

elizarov

02/02/2017, 4:04 PM
You need to write (or find) async http library first
Kotlin coroutines is a language feature (for library writers) not a framework
3 Views