1
1
.. title :: clang-tidy - misc-coroutine-hostile-raii
2
2
3
3
misc-coroutine-hostile-raii
4
- ====================
4
+ ===========================
5
5
6
6
Detects when objects of certain hostile RAII types persists across suspension
7
7
points in a coroutine. Such hostile types include scoped-lockable types and
8
8
types belonging to a configurable denylist.
9
9
10
- Some objects require that they be destroyed on the same thread that created them.
10
+ Some objects require that they be destroyed on the same thread that created them.
11
11
Traditionally this requirement was often phrased as "must be a local variable",
12
12
under the assumption that local variables always work this way. However this is
13
13
incorrect with C++20 coroutines, since an intervening ``co_await `` may cause the
14
14
coroutine to suspend and later be resumed on another thread.
15
15
16
- The lifetime of an object that requires being destroyed on the same thread must
16
+ The lifetime of an object that requires being destroyed on the same thread must
17
17
not encompass a ``co_await `` or ``co_yield `` point. If you create/destroy an object,
18
18
you must do so without allowing the coroutine to suspend in the meantime.
19
19
20
20
Following types are considered as hostile:
21
21
22
22
- Scoped-lockable types: A scoped-lockable object persisting across a suspension
23
- point is problematic as the lock held by this object could be unlocked by a
23
+ point is problematic as the lock held by this object could be unlocked by a
24
24
different thread. This would be undefined behaviour.
25
25
This includes all types annotated with the ``scoped_lockable `` attribute.
26
26
@@ -44,7 +44,7 @@ Options
44
44
45
45
.. option :: RAIITypesList
46
46
47
- A semicolon-separated list of qualified types which should not be allowed to
47
+ A semicolon-separated list of qualified types which should not be allowed to
48
48
persist across suspension points.
49
49
Eg: ``my::lockable; a::b;::my::other::lockable; ``
50
- The default value of this option is `"std::lock_guard;std::scoped_lock" `.
50
+ The default value of this option is `"std::lock_guard;std::scoped_lock" `.
0 commit comments