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

danny

10/18/2018, 7:14 PM
Are workers as a concept planned for the stable release of coroutines, or coming later?
i.e. not just constraining concurrency with a
newFixedThreadPoolContext
, but the actual number of coroutines total?
n

nwh

10/18/2018, 8:34 PM
Can't you just keep track of the number of coroutines you launch? Or do I misunderstand your issue
e

enleur

10/18/2018, 8:53 PM
you want to limit your coroutines or count them?
d

danny

10/18/2018, 9:03 PM
Limit them - it's similar to Roman's KotlinConf presentation. In my case have I a connection pool and an external host I want to limit concurrency to. I want no more than that many workers running. There's an receive channel for keys to load, and an send channel for results - so those workers for loop in the receive channel
Right now, I just for loop a range
1..numWorkers
and
launch(<http://Dispatchers.IO|Dispatchers.IO>)
within the scope I need them to live for
e

enleur

10/18/2018, 9:47 PM
isn’t enough for you?
d

danny

10/18/2018, 9:52 PM
Sure, but sounded like there was a plan to support that as a pattern, I guess it's an
actor
?
d

danny

10/18/2018, 11:00 PM
That's the guy! I'll watch that
Cheers
3 Views