mirror of
https://github.com/ocaml-tracing/ocaml-trace.git
synced 2026-03-07 18:37:56 -05:00
b_queue: signal only if queue was empty
This commit is contained in:
parent
96fb44e6bb
commit
efafd34a9e
1 changed files with 2 additions and 1 deletions
|
|
@ -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
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue