File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,18 @@ let print_array a =
10
10
let r = Array. init 20 (fun i -> i + 1 )
11
11
12
12
let scan_task num_doms =
13
- let pool = Task. setup_pool ~num_domains: num_doms () in
14
- let a = Task. run pool (fun () -> Task. parallel_scan pool (+ ) (Array. make 20 1 )) in
15
- Task. teardown_pool pool;
16
- Printf. printf " %i: %s\n %!" num_doms (print_array a);
17
- assert (a = r)
13
+ try
14
+ let pool = Task. setup_pool ~num_domains: num_doms () in
15
+ let a = Task. run pool (fun () -> Task. parallel_scan pool (+ ) (Array. make 20 1 )) in
16
+ Task. teardown_pool pool;
17
+ Printf. printf " %i: %s\n %!" num_doms (print_array a);
18
+ assert (a = r)
19
+ with Failure msg ->
20
+ begin
21
+ assert (msg = " failed to allocate domain" );
22
+ Printf. printf " Failed to allocate %i domains, recommended_domain_count: %i\n %!"
23
+ num_doms (Domain. recommended_domain_count () );
24
+ end
18
25
;;
19
26
for num_dom= 0 to 21 do
20
27
scan_task num_dom;
You can’t perform that action at this time.
0 commit comments