also i'm trying to use `newFixedThreadPoolContext`...
# coroutines
s
also i'm trying to use
newFixedThreadPoolContext
to create a fixed amount of threads to run my function on..but i think i need to know the thread id it's running on (0 or 1..n)
e
What exactly your are trying to achieve?
s
i have work that can be done on an array, but only in a multithreaded manner if they are in separate sections of the array. my previous solution was just spawning n threads and partitioning their 'region' into n parts. now i wanna use coroutines and use the job/channel stuff
before it was essentially
for n in 1..4 { thread { dostuff(threadNum=n) } }
, but now i wanna try using coroutines (and the channel/producer classes) with a fixed number of threads
or is there a better approach?
e
You can do the same with coroutines. Just replace
thread
with
launch(CommonPool)