mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-09 04:35:33 -05:00
test for proper resource handling in Pool.shutdown
This commit is contained in:
parent
7b0e7de94d
commit
6c4d2cbc79
2 changed files with 14 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
(tests
|
(tests
|
||||||
(names t_fib t_bench1 t_fib_rec t_futs1 t_tree_futs t_props t_chan_train)
|
(names t_fib t_bench1 t_fib_rec t_futs1 t_tree_futs t_props t_chan_train t_resource)
|
||||||
(libraries moonpool qcheck-core qcheck-core.runner
|
(libraries moonpool qcheck-core qcheck-core.runner
|
||||||
;tracy-client.trace
|
;tracy-client.trace
|
||||||
trace))
|
trace))
|
||||||
|
|
|
||||||
13
test/t_resource.ml
Normal file
13
test/t_resource.ml
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
open! Moonpool
|
||||||
|
|
||||||
|
let ( let@ ) = ( @@ )
|
||||||
|
|
||||||
|
(* test proper resource handling *)
|
||||||
|
let () =
|
||||||
|
let a = Atomic.make 0 in
|
||||||
|
for _i = 1 to 1_000 do
|
||||||
|
(* allocate a new pool at each iteration *)
|
||||||
|
let@ p = Pool.with_ ~min:4 () in
|
||||||
|
Pool.run_wait_block p (fun () -> Atomic.incr a)
|
||||||
|
done;
|
||||||
|
assert (Atomic.get a = 1_000)
|
||||||
Loading…
Add table
Reference in a new issue