Skip to content

Commit 66ef7f6

Browse files
committed
---
yaml --- r: 81304 b: refs/heads/snap-stage3 c: d6c3b67 h: refs/heads/master v: v3
1 parent 1c76e05 commit 66ef7f6

File tree

2 files changed

+30
-20
lines changed

2 files changed

+30
-20
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 8bb48cc1e607a7189c80c1d0f3f5567312bf1a99
4+
refs/heads/snap-stage3: d6c3b67348d9d6860051a04ee24e284414fa49a6
55
refs/heads/try: 70152ff55722878cde684ee6462c14c65f2c4729
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libstd/task/mod.rs

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,34 @@
1313
*
1414
* An executing Rust program consists of a tree of tasks, each with their own
1515
* stack, and sole ownership of their allocated heap data. Tasks communicate
16-
* with each other using ports and channels.
16+
* with each other using ports and channels (see std::rt::comm for more info
17+
* about how communication works).
1718
*
18-
* When a task fails, that failure will propagate to its parent (the task
19-
* that spawned it) and the parent will fail as well. The reverse is not
20-
* true: when a parent task fails its children will continue executing. When
21-
* the root (main) task fails, all tasks fail, and then so does the entire
22-
* process.
19+
* Tasks can be spawned in 3 different modes.
2320
*
24-
* Tasks may execute in parallel and are scheduled automatically by the
25-
* runtime.
21+
* * Bidirectionally linked: This is the default mode and it's what ```spawn``` does.
22+
* Failures will be propagated from parent to child and vice versa.
23+
*
24+
* * Unidirectionally linked (parent->child): This type of task can be created with
25+
* ```spawn_supervised```. In this case, failures are propagated from parent to child
26+
* but not the other way around.
27+
*
28+
* * Unlinked: Tasks can be completely unlinked. These tasks can be created by using
29+
* ```spawn_unlinked```. In this case failures are not propagated at all.
30+
*
31+
* Tasks' failure modes can be further configured. For instance, parent tasks can (un)watch
32+
* children failures. Please, refer to TaskBuilder's documentation bellow for more information.
33+
*
34+
* When a (bi|uni)directionally linked task fails, its failure will be propagated to all tasks
35+
* linked to it, this will cause such tasks to fail by a `linked failure`.
36+
*
37+
* Task Scheduling:
38+
*
39+
* By default, every task is created in the same scheduler as its parent, where it
40+
* is scheduled cooperatively with all other tasks in that scheduler. Some specialized
41+
* applications may want more control over their scheduling, in which case they can be
42+
* spawned into a new scheduler with the specific properties required. See TaskBuilder's
43+
* documentation bellow for more information.
2644
*
2745
* # Example
2846
*
@@ -120,17 +138,9 @@ pub struct SchedOpts {
120138
* * name - A name for the task-to-be, for identification in failure messages.
121139
*
122140
* * sched - Specify the configuration of a new scheduler to create the task
123-
* in
124-
*
125-
* By default, every task is created in the same scheduler as its
126-
* parent, where it is scheduled cooperatively with all other tasks
127-
* in that scheduler. Some specialized applications may want more
128-
* control over their scheduling, in which case they can be spawned
129-
* into a new scheduler with the specific properties required.
130-
*
131-
* This is of particular importance for libraries which want to call
132-
* into foreign code that blocks. Without doing so in a different
133-
* scheduler other tasks will be impeded or even blocked indefinitely.
141+
* in. This is of particular importance for libraries which want to call
142+
* into foreign code that blocks. Without doing so in a different
143+
* scheduler other tasks will be impeded or even blocked indefinitely.
134144
*/
135145
pub struct TaskOpts {
136146
linked: bool,

0 commit comments

Comments
 (0)