diff --git a/src/index.ocaml5.ml b/src/index.ocaml5.ml index d067ff4..94b23a3 100644 --- a/src/index.ocaml5.ml +++ b/src/index.ocaml5.ml @@ -129,7 +129,7 @@ open struct t.on_first_get t domain end else Index_allocator.release t.index_allocator index; - new_index + instantaneous_domain_index t domain end else begin Index_allocator.release t.index_allocator new_index; diff --git a/test/Multicore_magic_test.ml b/test/Multicore_magic_test.ml index 03e9f10..d0de84e 100644 --- a/test/Multicore_magic_test.ml +++ b/test/Multicore_magic_test.ml @@ -107,6 +107,7 @@ let test_instantaneous_domain_index () = let module Atomic = Multicore_magic.Transparent_atomic in let stress () = let n_domains = 7 in + let slack = 1 in let num_started = Atomic.make 0 |> Multicore_magic.copy_as_padded in let num_exited = Atomic.make 0 |> Multicore_magic.copy_as_padded in let failed = ref false |> Multicore_magic.copy_as_padded in @@ -115,7 +116,7 @@ let test_instantaneous_domain_index () = let num_exited = Atomic.get num_exited in let i = Multicore_magic.instantaneous_domain_index () in let n = Atomic.get num_started - num_exited in - if i < 0 || n < i then failed := true + if i < 0 || n + slack < i then failed := true in let domain () =