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

elizarov

09/22/2017, 8:09 PM
You create a channel and run
N
worker coroutines that all take tasks from this channel and do your http calls. The number of coroutines you have limits the number of concurrent HTTP requests without having you think about threads at all. In fact, if your HTTP library is truly async, they can all simply run a single thread, yet still giving you control over maximal concurrency.
g

gildor

09/25/2017, 3:24 AM
@oshai I’ve posted an answer to your SO question.
o

oshai

09/25/2017, 6:26 AM
Thanks, I reviewed it and edit the question a bit (it was a mistake not to have local var for the thread pool) my question is if in that case it is working because threads are blocked?
g

gildor

09/25/2017, 7:17 AM
Answered
o

oshai

09/25/2017, 7:47 AM
Thanks
12 Views