From efafd34a9ef9e46a86fded6c75994ace8187eeeb Mon Sep 17 00:00:00 2001 From: Corentin Leruth Date: Wed, 23 Aug 2023 08:43:13 +0200 Subject: [PATCH] b_queue: signal only if queue was empty --- src/tef/b_queue.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tef/b_queue.ml b/src/tef/b_queue.ml index f7abac4..3780c38 100644 --- a/src/tef/b_queue.ml +++ b/src/tef/b_queue.ml @@ -29,8 +29,9 @@ let push (self : _ t) x : unit = Mutex.unlock self.mutex; raise Closed ) else ( + let was_empty = Queue.is_empty self.q in Queue.push x self.q; - Condition.signal self.cond; + if was_empty then Condition.signal self.cond; Mutex.unlock self.mutex )