Commit 24933cd1 authored by Guillaume Melquiond's avatar Guillaume Melquiond
Browse files

Avoid using Queue.t for a one-shot data structure, especially an unordered one.

parent 69e8633a
...@@ -400,15 +400,14 @@ let get_new_results ~blocking = (* TODO: handle ProverStarted events *) ...@@ -400,15 +400,14 @@ let get_new_results ~blocking = (* TODO: handle ProverStarted events *)
let forward_results ~blocking = let forward_results ~blocking =
get_new_results ~blocking; get_new_results ~blocking;
let q = Queue.create () in let q = ref [] in
Hashtbl.iter (fun key element -> Hashtbl.iter (fun key element ->
if element = ProverStarted && blocking then if element = ProverStarted && blocking then
() ()
else else
Queue.push (ServerCall key, element) q) result_buffer; q := (ServerCall key, element) :: !q) result_buffer;
Hashtbl.clear result_buffer; Hashtbl.clear result_buffer;
q !q
let query_result_buffer id = let query_result_buffer id =
try let r = Hashtbl.find result_buffer id in try let r = Hashtbl.find result_buffer id in
......
...@@ -163,10 +163,8 @@ type prover_update = ...@@ -163,10 +163,8 @@ type prover_update =
| ProverStarted | ProverStarted
| ProverFinished of prover_result | ProverFinished of prover_result
val forward_results: blocking:bool -> (prover_call * prover_update) list
val forward_results: blocking:bool -> (prover_call * prover_update) Queue.t (** returns new results from why3server, in an unordered fashion. *)
(** returns new results that are given by why3server. *)
val query_call : prover_call -> prover_update val query_call : prover_call -> prover_update
(** non-blocking function that reports any new updates (** non-blocking function that reports any new updates
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment