tmp/tmpt9c7cb5g/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Class template `rcu_obj_base` <a id="saferecl.rcu.base">[[saferecl.rcu.base]]</a>
|
| 2 |
+
|
| 3 |
+
Objects of type `T` to be protected by RCU inherit from a specialization
|
| 4 |
+
`rcu_obj_base<T, D>` for some `D`.
|
| 5 |
+
|
| 6 |
+
``` cpp
|
| 7 |
+
namespace std {
|
| 8 |
+
template<class T, class D = default_delete<T>>
|
| 9 |
+
class rcu_obj_base {
|
| 10 |
+
public:
|
| 11 |
+
void retire(D d = D(), rcu_domain& dom = rcu_default_domain()) noexcept;
|
| 12 |
+
protected:
|
| 13 |
+
rcu_obj_base() = default;
|
| 14 |
+
rcu_obj_base(const rcu_obj_base&) = default;
|
| 15 |
+
rcu_obj_base(rcu_obj_base&&) = default;
|
| 16 |
+
rcu_obj_base& operator=(const rcu_obj_base&) = default;
|
| 17 |
+
rcu_obj_base& operator=(rcu_obj_base&&) = default;
|
| 18 |
+
~rcu_obj_base() = default;
|
| 19 |
+
private:
|
| 20 |
+
D deleter; // exposition only
|
| 21 |
+
};
|
| 22 |
+
}
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
The behavior of a program that adds specializations for `rcu_obj_base`
|
| 26 |
+
is undefined.
|
| 27 |
+
|
| 28 |
+
`T` may be an incomplete type. It shall be complete before any member of
|
| 29 |
+
the resulting specialization of `rcu_obj_base` is referenced.
|
| 30 |
+
|
| 31 |
+
`D` shall be a function object type [[function.objects]] for which,
|
| 32 |
+
given a value `d` of type `D` and a value `ptr` of type `T*`, the
|
| 33 |
+
expression `d(ptr)` is valid.
|
| 34 |
+
|
| 35 |
+
`D` shall meet the requirements for *Cpp17DefaultConstructible* and
|
| 36 |
+
*Cpp17MoveAssignable*.
|
| 37 |
+
|
| 38 |
+
If `D` is trivially copyable, all specializations of
|
| 39 |
+
`rcu_obj_base<T, D>` are trivially copyable.
|
| 40 |
+
|
| 41 |
+
``` cpp
|
| 42 |
+
void retire(D d = D(), rcu_domain& dom = rcu_default_domain()) noexcept;
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
*Mandates:* `T` is an rcu-protectable type.
|
| 46 |
+
|
| 47 |
+
*Preconditions:* `*this` is a base class subobject of an object `x` of
|
| 48 |
+
type `T`. The member function `rcu_obj_base<T, D>::retire` was not
|
| 49 |
+
invoked on `x` before. The assignment to *deleter* does not exit via an
|
| 50 |
+
exception.
|
| 51 |
+
|
| 52 |
+
*Effects:* Evaluates *`deleter`*` = std::move(d)` and schedules the
|
| 53 |
+
evaluation of the expression *`deleter`*`( addressof(x))` in the domain
|
| 54 |
+
`dom`; the behavior is undefined if that evaluation exits via an
|
| 55 |
+
exception. May invoke scheduled evaluations in `dom`.
|
| 56 |
+
|
| 57 |
+
[*Note 1*: If such evaluations acquire resources held across any
|
| 58 |
+
invocation of `retire` on `dom`, deadlock can occur. — *end note*]
|
| 59 |
+
|