mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-07 11:45:39 -05:00
fix readme
This commit is contained in:
parent
e14fef2834
commit
6d6acba541
2 changed files with 6 additions and 4 deletions
|
|
@ -19,7 +19,8 @@ In addition, some concurrency and parallelism primitives are provided:
|
||||||
On OCaml 5 (meaning there's actual domains and effects, not just threads),
|
On OCaml 5 (meaning there's actual domains and effects, not just threads),
|
||||||
a `Fut.await` primitive is provided. It's simpler and more powerful
|
a `Fut.await` primitive is provided. It's simpler and more powerful
|
||||||
than the monadic combinators.
|
than the monadic combinators.
|
||||||
- `Moonpool.Fork_join` provides the fork-join parallelism primitives
|
- `Moonpool_forkjoin`, in the library `moonpool.forkjoin`
|
||||||
|
provides the fork-join parallelism primitives
|
||||||
to use within tasks running in the pool.
|
to use within tasks running in the pool.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
@ -166,7 +167,8 @@ val expected_sum : int = 5050
|
||||||
|
|
||||||
### Fork-join
|
### Fork-join
|
||||||
|
|
||||||
On OCaml 5, again using effect handlers, the module `Fork_join`
|
On OCaml 5, again using effect handlers, the sublibrary `moonpool.forkjoin`
|
||||||
|
provides a module `Moonpool_forkjoin`
|
||||||
implements the [fork-join model](https://en.wikipedia.org/wiki/Fork%E2%80%93join_model).
|
implements the [fork-join model](https://en.wikipedia.org/wiki/Fork%E2%80%93join_model).
|
||||||
It must run on a pool (using `Runner.run_async` or inside a future via `Fut.spawn`).
|
It must run on a pool (using `Runner.run_async` or inside a future via `Fut.spawn`).
|
||||||
|
|
||||||
|
|
@ -220,7 +222,7 @@ And a parallel quicksort for larger slices:
|
||||||
done;
|
done;
|
||||||
|
|
||||||
(* sort lower half and upper half in parallel *)
|
(* sort lower half and upper half in parallel *)
|
||||||
Moonpool.Fork_join.both_ignore
|
Moonpool_forkjoin.both_ignore
|
||||||
(fun () -> quicksort arr i (!low - i))
|
(fun () -> quicksort arr i (!low - i))
|
||||||
(fun () -> quicksort arr !low (len - (!low - i)))
|
(fun () -> quicksort arr !low (len - (!low - i)))
|
||||||
);;
|
);;
|
||||||
|
|
|
||||||
2
dune
2
dune
|
|
@ -3,6 +3,6 @@
|
||||||
(flags :standard -strict-sequence -warn-error -a+8 -w +a-4-40-42-70)))
|
(flags :standard -strict-sequence -warn-error -a+8 -w +a-4-40-42-70)))
|
||||||
|
|
||||||
(mdx
|
(mdx
|
||||||
(libraries moonpool threads)
|
(libraries moonpool moonpool.forkjoin threads)
|
||||||
(enabled_if
|
(enabled_if
|
||||||
(>= %{ocaml_version} 5.0)))
|
(>= %{ocaml_version} 5.0)))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue