mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
details in test
This commit is contained in:
parent
e8cc87f1f5
commit
e1219ade54
1 changed files with 8 additions and 2 deletions
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
open Moonpool
|
open Moonpool
|
||||||
|
|
||||||
|
let ( let@ ) = ( @@ )
|
||||||
|
|
||||||
let rec fib_direct x =
|
let rec fib_direct x =
|
||||||
if x <= 1 then
|
if x <= 1 then
|
||||||
1
|
1
|
||||||
|
|
@ -18,7 +20,7 @@ let fib ~on x : int Fut.t =
|
||||||
Fut.await t1 + Fut.await t2
|
Fut.await t1 + Fut.await t2
|
||||||
)
|
)
|
||||||
in
|
in
|
||||||
Fut.spawn ~on (fun () -> fib_rec x)
|
Fut.spawn ~name:"fib" ~on (fun () -> fib_rec x)
|
||||||
|
|
||||||
(* NOTE: for tracy support
|
(* NOTE: for tracy support
|
||||||
let () = Tracy_client_trace.setup ()
|
let () = Tracy_client_trace.setup ()
|
||||||
|
|
@ -46,9 +48,13 @@ let run_test () =
|
||||||
|
|
||||||
assert (res = Ok (Array.make 3 fib_40))
|
assert (res = Ok (Array.make 3 fib_40))
|
||||||
|
|
||||||
let () =
|
let main () =
|
||||||
(* now make sure we can do this with multiple pools in parallel *)
|
(* now make sure we can do this with multiple pools in parallel *)
|
||||||
let jobs = Array.init 2 (fun _ -> Thread.create run_test ()) in
|
let jobs = Array.init 2 (fun _ -> Thread.create run_test ()) in
|
||||||
Array.iter Thread.join jobs
|
Array.iter Thread.join jobs
|
||||||
|
|
||||||
|
let () =
|
||||||
|
let@ () = Trace_tef.with_setup () in
|
||||||
|
main ()
|
||||||
|
|
||||||
[@@@endif]
|
[@@@endif]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue