diff options
Diffstat (limited to 'stm')
| -rw-r--r-- | stm/tQueue.ml | 7 | ||||
| -rw-r--r-- | stm/tQueue.mli | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/stm/tQueue.ml b/stm/tQueue.ml index 783c545fd0..bf55eaf774 100644 --- a/stm/tQueue.ml +++ b/stm/tQueue.ml @@ -42,6 +42,13 @@ let push { queue = q; lock = m; cond = c } x = Condition.signal c; Mutex.unlock m +let clear { queue = q; lock = m; cond = c } = + Mutex.lock m; + Queue.clear q; + Mutex.unlock m + +let is_empty { queue = q } = Queue.is_empty q + let wait_until_n_are_waiting_and_queue_empty j tq = Mutex.lock tq.lock; while not (Queue.is_empty tq.queue) || tq.nwaiting < j do diff --git a/stm/tQueue.mli b/stm/tQueue.mli index a3ea5532fc..f3703285a8 100644 --- a/stm/tQueue.mli +++ b/stm/tQueue.mli @@ -15,3 +15,5 @@ val push : 'a t -> 'a -> unit val reorder : 'a t -> ('a -> 'a -> int) -> unit val wait_until_n_are_waiting_and_queue_empty : int -> 'a t -> unit val dump : 'a t -> 'a list +val clear : 'a t -> unit +val is_empty : 'a t -> bool |
