Add a new module called "sync" which provides a set of high-level synchronization primitives not offered in the standard library.
My first idea is AsyncBarrier: when all coroutines that share the same barrier object calls wait(), then they are all blocked until all of them calls wait(). If all has called wait(), resume their execution. Preferably, the API should look like threading.Barrier.
Let's also write test suites for it.
Ideas for other synchronization primitives are welcome.
Add a new module called "sync" which provides a set of high-level synchronization primitives not offered in the standard library.
My first idea is AsyncBarrier: when all coroutines that share the same barrier object calls
wait()
, then they are all blocked until all of them callswait()
. If all has calledwait()
, resume their execution. Preferably, the API should look likethreading.Barrier
. Let's also write test suites for it.Ideas for other synchronization primitives are welcome.