Repository navigation
Commit 1649cf3
committed
fix(when_any): guard stop callback against inline completion destroying the opstate
If every child completes set_stopped() synchronously from inside
__stop_source_.request_stop() (senders that complete inline from their
stop callbacks), __count_ reaches zero and the receiver is completed --
destroying the operation state, including __stop_source_, while
request_stop() is still iterating its callback list. The subsequent
relock then spins on freed memory.
Adopt __when_all's rug-pull guard: temporarily increment __count_
around request_stop() in the stop callback and arrive afterwards, so
completion is deferred until the callback has returned.1 parent 61fb73d commit 1649cf3
1 file changed
Lines changed: 24 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
86 | 103 | | |
87 | | - | |
| 104 | + | |
88 | 105 | | |
89 | 106 | | |
90 | 107 | | |
| |||
127 | 144 | | |
128 | 145 | | |
129 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
130 | 152 | | |
131 | 153 | | |
132 | 154 | | |
| |||
203 | 225 | | |
204 | 226 | | |
205 | 227 | | |
206 | | - | |
| 228 | + | |
207 | 229 | | |
208 | 230 | | |
209 | 231 | | |
| |||
0 commit comments