File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,26 @@ module AsyncExtensions =
4040 { new IDisposable with
4141 member x.Dispose () = ct.Cancel() }
4242
43+ /// Creates an async computations which runs the specified computations
44+ /// in parallel and returns their results.
45+ static member Parallel ( a : Async < 'a >, b : Async < 'b >) : Async < 'a * 'b > = async {
46+ let! a = a |> Async.StartChild
47+ let! b = b |> Async.StartChild
48+ let! a = a
49+ let! b = b
50+ return a, b }
51+
52+ /// Creates an async computations which runs the specified computations
53+ /// in parallel and returns their results.
54+ static member Parallel ( a : Async < 'a >, b : Async < 'b >, c : Async < 'c >) : Async < 'a * 'b * 'c > = async {
55+ let! a = a |> Async.StartChild
56+ let! b = b |> Async.StartChild
57+ let! c = c |> Async.StartChild
58+ let! a = a
59+ let! b = b
60+ let! c = c
61+ return a, b, c }
62+
4363 /// An async computation which does nothing.
4464 static member inline unit = AsyncOps.unit
4565
You can’t perform that action at this time.
0 commit comments