We need a way to restrict amount of created process when we use our futures. It's not process pool like in #21, it's just a limit of amount of processes. So if I do something like
module Future4 =
Future.Make(struct
let process_limit = 4
end)
let inc x = x + 1 in
1 -- 100 |> List.map (Future4.future inc) |> List.map Future4.force |> List.iter print_int
I know that there will no more than 4 child processes created during this operation.
Relations
Description
We need a way to restrict amount of created process when we use our futures. It's not process pool like in #21, it's just a limit of amount of processes. So if I do something like
I know that there will no more than 4 child processes created during this operation.