From Jason Turner

[saferecl.rcu.domain]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmps8_r2_1v/{from.md → to.md} +132 -0
tmp/tmps8_r2_1v/{from.md → to.md} RENAMED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Class `rcu_domain` <a id="saferecl.rcu.domain">[[saferecl.rcu.domain]]</a>
2
+
3
+ ##### General <a id="saferecl.rcu.domain.general">[[saferecl.rcu.domain.general]]</a>
4
+
5
+ ``` cpp
6
+ namespace std {
7
+ class rcu_domain {
8
+ public:
9
+ rcu_domain(const rcu_domain&) = delete;
10
+ rcu_domain& operator=(const rcu_domain&) = delete;
11
+
12
+ void lock() noexcept;
13
+ bool try_lock() noexcept;
14
+ void unlock() noexcept;
15
+ };
16
+ }
17
+ ```
18
+
19
+ This class meets the requirements of *Cpp17Lockable*
20
+ [[thread.req.lockable.req]] and provides regions of RCU protection.
21
+
22
+ [*Example 1*:
23
+
24
+ ``` cpp
25
+ std::scoped_lock<rcu_domain> rlock(rcu_default_domain());
26
+ ```
27
+
28
+ — *end example*]
29
+
30
+ The functions `lock` and `unlock` establish (possibly nested) regions of
31
+ RCU protection.
32
+
33
+ ##### Member functions <a id="saferecl.rcu.domain.members">[[saferecl.rcu.domain.members]]</a>
34
+
35
+ ``` cpp
36
+ void lock() noexcept;
37
+ ```
38
+
39
+ *Effects:* Opens a region of RCU protection.
40
+
41
+ *Remarks:* Calls to `lock` do not introduce a data race [[intro.races]]
42
+ involving `*this`.
43
+
44
+ ``` cpp
45
+ bool try_lock() noexcept;
46
+ ```
47
+
48
+ *Effects:* Equivalent to `lock()`.
49
+
50
+ *Returns:* `true`.
51
+
52
+ ``` cpp
53
+ void unlock() noexcept;
54
+ ```
55
+
56
+ *Preconditions:* A call to `lock` that opened an unclosed region of RCU
57
+ protection is sequenced before the call to `unlock`.
58
+
59
+ *Effects:* Closes the unclosed region of RCU protection that was most
60
+ recently opened. May invoke scheduled evaluations in `*this`.
61
+
62
+ [*Note 1*: If such evaluations acquire resources held across any
63
+ invocation of `unlock` on `*this`, deadlock can occur. — *end note*]
64
+
65
+ *Remarks:* Calls to `unlock` do not introduce a data race involving
66
+ `*this`.
67
+
68
+ [*Note 2*: Evaluation of scheduled evaluations can still cause a data
69
+ race. — *end note*]
70
+
71
+ ##### Non-member functions <a id="saferecl.rcu.domain.func">[[saferecl.rcu.domain.func]]</a>
72
+
73
+ ``` cpp
74
+ rcu_domain& rcu_default_domain() noexcept;
75
+ ```
76
+
77
+ *Returns:* A reference to a static-duration object of type `rcu_domain`.
78
+ A reference to the same object is returned every time this function is
79
+ called.
80
+
81
+ ``` cpp
82
+ void rcu_synchronize(rcu_domain& dom = rcu_default_domain()) noexcept;
83
+ ```
84
+
85
+ *Effects:* If the call to `rcu_synchronize` does not strongly happen
86
+ before the lock opening an RCU protection region `R` on `dom`, blocks
87
+ until the `unlock` closing `R` happens.
88
+
89
+ *Synchronization:* The `unlock` closing `R` strongly happens before the
90
+ return from `rcu_synchronize`.
91
+
92
+ ``` cpp
93
+ void rcu_barrier(rcu_domain& dom = rcu_default_domain()) noexcept;
94
+ ```
95
+
96
+ *Effects:* May evaluate any scheduled evaluations in `dom`. For any
97
+ evaluation that happens before the call to `rcu_barrier` and that
98
+ schedules an evaluation E in `dom`, blocks until E has been evaluated.
99
+
100
+ *Synchronization:* The evaluation of any such E strongly happens before
101
+ the return from `rcu_barrier`.
102
+
103
+ [*Note 3*: A call to `rcu_barrier` does not imply a call to
104
+ `rcu_synchronize` and vice versa. — *end note*]
105
+
106
+ ``` cpp
107
+ template<class T, class D = default_delete<T>>
108
+ void rcu_retire(T* p, D d = D(), rcu_domain& dom = rcu_default_domain());
109
+ ```
110
+
111
+ *Mandates:* `is_move_constructible_v<D>` is `true` and the expression
112
+ `d(p)` is well-formed.
113
+
114
+ *Preconditions:* `D` meets the *Cpp17MoveConstructible* and
115
+ *Cpp17Destructible* requirements.
116
+
117
+ *Effects:* May allocate memory. It is unspecified whether the memory
118
+ allocation is performed by invoking `operator new`. Initializes an
119
+ object `d1` of type `D` from `std::move(d)`. Schedules the evaluation of
120
+ `d1(p)` in the domain `dom`; the behavior is undefined if that
121
+ evaluation exits via an exception. May invoke scheduled evaluations in
122
+ `dom`.
123
+
124
+ [*Note 4*: If `rcu_retire` exits via an exception, no evaluation is
125
+ scheduled. — *end note*]
126
+
127
+ *Throws:* `bad_alloc` or any exception thrown by the initialization of
128
+ `d1`.
129
+
130
+ [*Note 5*: If scheduled evaluations acquire resources held across any
131
+ invocation of `rcu_retire` on `dom`, deadlock can occur. — *end note*]
132
+