From 32020588430afea87f78c8da1d5058d98535519e Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Thu, 28 Nov 2024 09:12:18 +0000 Subject: [PATCH] Initialise Imperative priority queue array on creation No need to wait. Signed-off-by: Frediano Ziglio --- ocaml/libs/xapi-stdext/lib/xapi-stdext-threads/ipq.ml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ocaml/libs/xapi-stdext/lib/xapi-stdext-threads/ipq.ml b/ocaml/libs/xapi-stdext/lib/xapi-stdext-threads/ipq.ml index 0c0a458e2c..4cf29ed3d9 100644 --- a/ocaml/libs/xapi-stdext/lib/xapi-stdext-threads/ipq.ml +++ b/ocaml/libs/xapi-stdext/lib/xapi-stdext-threads/ipq.ml @@ -24,7 +24,7 @@ let create n default = invalid_arg "create" else let default = {ev= default; time= Mtime_clock.now ()} in - {default; size= -n; data= [||]} + {default; size= 0; data= Array.make n default} let is_empty h = h.size <= 0 @@ -38,11 +38,6 @@ let resize h = h.data <- d' let add h x = - (* first addition: we allocate the array *) - if h.size < 0 then ( - h.data <- Array.make (-h.size) h.default ; - h.size <- 0 - ) ; let n = h.size in (* resizing if needed *) if n = Array.length h.data then resize h ;