Просмотр исходного кода

doc: a note about shared processes

skypjack 7 месяцев назад
Родитель
Сommit
abdb293106
1 измененных файлов с 16 добавлено и 0 удалено
  1. 16 0
      docs/md/process.md

+ 16 - 0
docs/md/process.md

@@ -5,6 +5,7 @@
 * [Introduction](#introduction)
 * [Introduction](#introduction)
 * [The process](#the-process)
 * [The process](#the-process)
   * [Continuation](#continuation)
   * [Continuation](#continuation)
+  * [Shared process](#shared-process)
 * [The scheduler](#the-scheduler)
 * [The scheduler](#the-scheduler)
 
 
 # Introduction
 # Introduction
@@ -108,6 +109,21 @@ The lambda function is such that it accepts a reference to the process that
 manages it (to be able to terminate it, pause it and so on), plus the usual
 manages it (to be able to terminate it, pause it and so on), plus the usual
 values also passed to the `update` function.
 values also passed to the `update` function.
 
 
+## Shared process
+
+All processes inherit from `std::enable_shared_from_this` to allow sharing with
+the caller.<br/>
+The returned smart pointer was created using the allocator associated with the
+scheduler and therefore all its processes. This same allocator is available by
+invoking `get_allocator` on the process itself.
+
+As far as possible, sharing a process is not intended to allow the caller to
+manage it. This could actually compromise the proper functioning of the
+scheduler and the process itself.<br/>
+Rather, the purpose is to allow the callers to save a valid reference to the
+process, allowing them to intervene in its lifecycle through calls like `pause`
+and the like.
+
 # The scheduler
 # The scheduler
 
 
 A cooperative scheduler runs different processes and helps manage their life
 A cooperative scheduler runs different processes and helps manage their life