mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
update a test
This commit is contained in:
parent
9a46b4527c
commit
61f1ca3231
1 changed files with 3 additions and 1 deletions
|
|
@ -67,13 +67,15 @@ let with_acquire ~n t ~f =
|
||||||
let n = CCLock.create 0 in
|
let n = CCLock.create 0 in
|
||||||
let a = Array.init 100 (fun i ->
|
let a = Array.init 100 (fun i ->
|
||||||
Thread.create (fun _ ->
|
Thread.create (fun _ ->
|
||||||
|
for _i = 1 to 100 do
|
||||||
with_acquire ~n:(1 + (i mod 5)) s
|
with_acquire ~n:(1 + (i mod 5)) s
|
||||||
~f:(fun () -> CCLock.incr n)
|
~f:(fun () -> CCLock.incr n)
|
||||||
|
done
|
||||||
) ())
|
) ())
|
||||||
in
|
in
|
||||||
Array.iter Thread.join a;
|
Array.iter Thread.join a;
|
||||||
assert_equal ~printer:CCInt.to_string 5 (get s);
|
assert_equal ~printer:CCInt.to_string 5 (get s);
|
||||||
assert_equal ~printer:CCInt.to_string 100 (CCLock.get n)
|
assert_equal ~printer:CCInt.to_string 10_000 (CCLock.get n)
|
||||||
*)
|
*)
|
||||||
|
|
||||||
let wait_until_at_least ~n t ~f =
|
let wait_until_at_least ~n t ~f =
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue