Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
(domain-local-await (>= 0.1.0))
(kcas (and (>= 0.3.0) :with-test))
(mirage-clock-unix (and :with-test (>= "4.2.0")))
(qcheck-core (and :with-test (>= "0.20")))
(qcheck-core (and :with-test (>= "0.90")))
(qcheck-multicoretests-util (and :with-test (>= "0.1")))
(qcheck-stm (and :with-test (>= "0.1")))))
6 changes: 3 additions & 3 deletions lib/task.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type message =
type task_chan = message Multi_channel.t

type pool_data = {
domains : unit Domain.t array;
domains : unit Domain.t option array;
task_chan : task_chan;
name: string option
}
Expand Down Expand Up @@ -143,7 +143,7 @@ let setup_pool ?name ~num_domains () =
else
let task_chan = Multi_channel.make (num_domains+1) in
let domains = Array.init num_domains (fun _ ->
Domain.spawn (fun _ -> worker task_chan))
try Some (Domain.spawn (fun _ -> worker task_chan)) with Failure _ -> None)
in
let p = Atomic.make (Some {domains; task_chan; name}) in
begin match name with
Expand All @@ -161,7 +161,7 @@ let teardown_pool pool =
Multi_channel.send pd.task_chan Quit
done;
Multi_channel.clear_local_state pd.task_chan;
Array.iter Domain.join pd.domains;
Array.iter (Option.iter Domain.join) pd.domains;
(* Remove the pool from the table *)
begin match pd.name with
| None -> ()
Expand Down
6 changes: 3 additions & 3 deletions test/task_parallel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let count = 250

let test_parallel_for =
Test.make ~name:"Domainslib.Task.parallel_for test" ~count
(triple (int_bound 10) small_nat small_nat)
(triple (int_bound 10) nat_small nat_small)
(fun (num_domains,array_size,chunk_size) ->
let pool = Task.setup_pool ~num_domains () in
let res = Task.run pool (fun () ->
Expand All @@ -19,7 +19,7 @@ let test_parallel_for =

let test_parallel_for_reduce =
Test.make ~name:"Domainslib.Task.parallel_for_reduce test" ~count
(triple (int_bound 10) small_nat small_nat)
(triple (int_bound 10) nat_small nat_small)
(fun (num_domains,array_size,chunk_size) ->
let pool = Task.setup_pool ~num_domains () in
let res = Task.run pool (fun () ->
Expand All @@ -29,7 +29,7 @@ let test_parallel_for_reduce =

let test_parallel_scan =
Test.make ~name:"Domainslib.Task.parallel_scan test" ~count
(pair (int_bound 10) small_nat)
(pair (int_bound 10) nat_small)
(fun (num_domains,array_size) ->
let pool = Task.setup_pool ~num_domains () in
let a = Task.run pool (fun () -> Task.parallel_scan pool (+) (Array.make array_size 1)) in
Expand Down