mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-05 19:00:33 -05:00
update test
This commit is contained in:
parent
b58041153a
commit
16663651d6
1 changed files with 6 additions and 3 deletions
|
|
@ -4,12 +4,12 @@ let ( let@ ) = ( @@ )
|
|||
|
||||
let () =
|
||||
let sum = Atomic.make 0 in
|
||||
let n = 300_000 in
|
||||
let n = 100_000 in
|
||||
|
||||
(let@ pool = Ws_pool.with_ ~num_threads:30 () in
|
||||
for _i = 1 to n do
|
||||
Runner.run_async pool (fun () ->
|
||||
Thread.yield ();
|
||||
Thread.delay 0.0001;
|
||||
ignore (Atomic.fetch_and_add sum 20 : int))
|
||||
done;
|
||||
Runner.shutdown pool);
|
||||
|
|
@ -17,5 +17,8 @@ let () =
|
|||
(* make sure that shutdown didn't terminate before
|
||||
all tasks were run *)
|
||||
let sum = Atomic.get sum in
|
||||
assert (sum = 20 * n);
|
||||
let expected = 20 * n in
|
||||
|
||||
Printf.printf "sum=%d, expected=%d\n%!" sum expected;
|
||||
assert (sum = expected);
|
||||
()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue