Skip to content

Commit 4ef9381

Browse files
committed
Update documentation
1 parent e0591ff commit 4ef9381

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

doc/user-guide.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ step, there are the `chain` and `chain'` functions:
213213
multiple transformation functions.
214214

215215

216-
### `->`, `->>` and `as->`
216+
### `->`, `->>` and `as->` (macros)
217217

218218
**NOTE**: `->` and `->>` introduced in 6.1.431, `as->` introduced in 6.1.434.
219219

@@ -342,8 +342,7 @@ the `all` helper.
342342
(p/then p (fn [[result1 result2]]
343343
(do-something-with-results result1 result2))))
344344
```
345-
346-
### `plet`
345+
### `plet` macro
347346

348347
The `plet` macro combines syntax of `let` with `all`; and enables a
349348
simple declaration of parallel operations followed by a body
@@ -368,6 +367,12 @@ previous example can be written using `all` in this manner:
368367
(fn [[a b c]] (+ a b c)))
369368
```
370369

370+
The real parallelism strictly depends on the underlying implementation
371+
of the executed functions. If they does syncrhonous work, all the code
372+
will be executed serially, almost identical to the standard let. Is
373+
the user responsability of the final execution model.
374+
375+
371376
### `any`
372377

373378
There are also circumstances where you only want the first
@@ -562,7 +567,8 @@ used (binded on the `promesa.exec/*default-executor*` dynamic var).
562567

563568
Also, in both cases, the returned promise is cancellable, so if for
564569
some reason the function is still not execued, the cancellation will
565-
prevent the execution.
570+
prevent the execution. You can cancel a cancellable promise with
571+
`p/cancel!` function.
566572

567573

568574
### Delayed Tasks
@@ -622,7 +628,7 @@ Since v9.0.x there are new factories that uses the JDK>=19 preview API:
622628

623629
### Helpers
624630

625-
#### `pmap`
631+
#### `pmap` (experimental)
626632

627633
This is a simplified `clojure.core/pmap` analogous function that allows
628634
execute a potentially computationally expensive or io bound functions
@@ -655,13 +661,17 @@ Example:
655661
;; => (1 2 3 4 5 6 7 8 9 10)
656662
```
657663

658-
#### `with-executor` macro
659-
664+
#### `with-executor` macro (experimental)
660665

661666
This allows run a scoped code with the `px/*default-executor*` binded
662667
to the provided executor. The provided executor can be a function for
663668
lazy executor instantiation.
664669

670+
It optionally accepts metadata on the executor part for indicate:
671+
672+
- `^:shutdown`: shutdown the pool before return
673+
- `^:interrupt`: shutdown and interrupt before return
674+
665675
There an example on how you can customize the executor for **pmap**:
666676

667677
```clojure
@@ -673,6 +683,7 @@ There an example on how you can customize the executor for **pmap**:
673683
;; => (1 2 3 4 5 6 7 8 9 10)
674684
```
675685

686+
676687
## Execution patterns
677688

678689
### CSP

0 commit comments

Comments
 (0)