Coroutine conditions (signals)


I would like to resume a coroutine based on a condition coming from another coroutine, in a manner very similar to what you would do with thread conditions. Thread conditions (i.e. java.util.concurrent.ReentrantLock and its associated condition) suspend the whole thread, blocking other coroutines from running.

All the examples I’ve seen on coroutines just use delay() to suspend. Is there a way to suspend a coroutine and then later tell the dispatcher that its ready to be resumed?


You can use Mutex instead of Lock.

To handle signals you can use Channels