ocaml-multicore / picos

Interoperable effects based concurrency
https://ocaml-multicore.github.io/picos/doc/picos/index.html
ISC License
86 stars 3 forks source link

Fix bounded queue example to use `Condition.broadcast` #185

Closed polytypic closed 3 months ago

polytypic commented 3 months ago

Using Condition.signal is not correct in these cases, because it is possible that multiple fibers manage to start Condition.wait and a single Condition.signal does not wake up all of them. Another alternative would be to Condition.signal every time the queue is not empty or is not full.