Hey coroutine experts
I have large amount of classes (
Layer1
) that are starting
Big chunk of work
on a single thread (
Layer2
) and then pass the result to another class (
Layer3
). Currently this chunk work is duplicated on each thread. I would like utilise coroutines to perform this
Big chunk of work
once on multiple threads and cache the result. Client class (
Layer
) can't use coroutines so these coroutines (
Layer2
) have to be a thread blocking call (Class no coroutines, nit suspended function).
• When a new instance of class (
Layer1
) wants to start work and work is already in progress (
Layer2
) then this (
Layer1
) waits for the
work
to be completed (
Layer2
) before proceeding further (
Layer3
) (we can block thread for now)
• When a new instance of class (
Layer1
) wants to start work and worj was already completed (on
Layer2
) then the result will be passed to following class
Layer3
will use cached result (existing
work
result)
I imagine this is double with coroutines. Can anybody help me with writing this code?