Skip to content

Commit 4334333

Browse files
committed
Note on use cases of Control.protect
1 parent 5c9d650 commit 4334333

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/picos_std.structured/picos_std_structured.mli

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ module Control : sig
6060
(** [protect thunk] forbids propagation of cancelation for the duration of
6161
[thunk ()].
6262
63+
ℹ️ {{!Picos_std_sync} Many operations are cancelable}. In particular,
64+
anything that might suspend the current fiber to await for something
65+
should typically be cancelable. Operations that release resources may
66+
sometimes also be cancelable and {{!Picos_std_finally.finally} calls of
67+
such operations should typically be protected} to ensure that resources
68+
will be properly released. Forbidding propagation of cancelation may also
69+
be required when a sequence of cancelable operations must be performed.
70+
6371
ℹ️ With the constructs provided by {{!Picos_std_structured} this library}
6472
it is not possible to prevent a fiber from being canceled, but it is
6573
possible for a fiber to forbid the scheduler from propagating cancelation

0 commit comments

Comments
 (0)