From Jason Turner

[exec.run.loop.members]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpizee0kne/{from.md → to.md} +65 -0
tmp/tmpizee0kne/{from.md → to.md} RENAMED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Member functions <a id="exec.run.loop.members">[[exec.run.loop.members]]</a>
2
+
3
+ ``` cpp
4
+ run-loop-opstate-base* pop-front();
5
+ ```
6
+
7
+ *Effects:* Blocks [[defns.block]] until one of the following conditions
8
+ is `true`:
9
+
10
+ - The `run_loop` instance’s count is 0 and its state is finishing, in
11
+ which case *pop-front* sets the state to finished and returns
12
+ `nullptr`; or
13
+ - the `run_loop` instance’s count is greater than 0, in which case an
14
+ item is removed from the front of the queue, the count is decremented
15
+ by `1`, and the removed item is returned.
16
+
17
+ ``` cpp
18
+ void push-back(run-loop-opstate-base* item);
19
+ ```
20
+
21
+ *Effects:* Adds `item` to the back of the queue and increments the
22
+ `run_loop` instance’s count by 1.
23
+
24
+ *Synchronization:* This operation synchronizes with the *pop-front*
25
+ operation that obtains `item`.
26
+
27
+ ``` cpp
28
+ run-loop-scheduler get_scheduler();
29
+ ```
30
+
31
+ *Returns:* An instance of *run-loop-scheduler* that can be used to
32
+ schedule work onto this `run_loop` instance.
33
+
34
+ ``` cpp
35
+ void run();
36
+ ```
37
+
38
+ *Preconditions:* The `run_loop` instance’s state is either starting or
39
+ finishing.
40
+
41
+ *Effects:* If the `run_loop` instance’s state is starting, sets the
42
+ state to running, otherwise leaves the state unchanged. Then, equivalent
43
+ to:
44
+
45
+ ``` cpp
46
+ while (auto* op = pop-front()) {
47
+ op->execute();
48
+ }
49
+ ```
50
+
51
+ *Remarks:* When the `run_loop` instance’s state changes, it does so
52
+ without introducing data races.
53
+
54
+ ``` cpp
55
+ void finish();
56
+ ```
57
+
58
+ *Preconditions:* The `run_loop` instance’s state is either starting or
59
+ running.
60
+
61
+ *Effects:* Changes the `run_loop` instance’s state to finishing.
62
+
63
+ *Synchronization:* `finish` synchronizes with the *pop-front* operation
64
+ that returns `nullptr`.
65
+