diff --git a/src/data_structures/synchronizer.ml b/src/data_structures/synchronizer.ml index de19fb47..39bd8dbb 100644 --- a/src/data_structures/synchronizer.ml +++ b/src/data_structures/synchronizer.ml @@ -46,7 +46,7 @@ let make_pledge synchro = let end_pledge synchro = Mutex.lock synchro.mutex; synchro.pledges <- synchro.pledges - 1; - Condition.broadcast synchro.cond; + if Int.equal synchro.pledges 0 then Condition.broadcast synchro.cond; Mutex.unlock synchro.mutex let fail q = diff --git a/src/data_structures/wq.ml b/src/data_structures/wq.ml index 842ec824..3548b555 100644 --- a/src/data_structures/wq.ml +++ b/src/data_structures/wq.ml @@ -27,8 +27,7 @@ let fail = Synchronizer.fail let make () = let q = Queue.create () in let writter v condvar = - let was_empty = Queue.is_empty q in Queue.push v q; - if was_empty then Condition.broadcast condvar + Condition.signal condvar in Synchronizer.init (fun () -> Queue.take_opt q) writter