Repository navigation
Commit a32df22
committed
♻️ Let the resource halt its own producer (#806)
The region stream registered an `ensure` that halted the producer it had just
spawned. It never did anything: a resource body is a task, `createTask` wraps it
in `encapsulate()`, and that helper's `finally` runs the task group's `halt()`,
which halts *and awaits* every spawned child in reverse order. The explicit call
halted a task the next teardown step was about to halt anyway.
What the comment claimed — that registering after the `spawn` is what makes
teardown halt and join the producer before the resource returns — was the
mechanism misread. Spawning inside this scope is already the whole of it.
Nothing about the lifetime changes, which is the point: SR8 still asserts the
exact order and still fails if the producer runs past the handler, verified by
giving the handler two more reads and watching `ran:2` appear.
Reported by review on PR #812.1 parent 71dedc2 commit a32df22
1 file changed
Lines changed: 9 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
| |||
156 | 158 | | |
157 | 159 | | |
158 | 160 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | 161 | | |
164 | 162 | | |
165 | 163 | | |
0 commit comments