Commit e86098e
committed
Forbid cancelation propagation during
I was previously undecided on whether it should be done implicitly, but it has
turned out to be surprising, so, now I'm convinced that the right thing to do is
to forbid cancelation propagation during resource `release` calls.
The issue is that if a fiber gets canceled, then resource `release` operations
that might need to await for something asynchronous may not be properly run to
completion. This can be surprising and, also, because this only happens in
cases of cancelation, which could happen at any moment, could be a major source
of subtle bugs.
The downside of forbidding cancelation is that in some cases a `release`
operation might block indefinitely and this can also cause issues. However, I
believe those cases will be both harder to miss (your program hangs rather than
leaks) and easier to debug (a debugger or stack trace should be able to point
you to the `release` call).release
1 parent 5e5a435 commit e86098e
File tree
2 files changed
+34
-7
lines changed- lib/picos_std.finally
2 files changed
+34
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
35 | 56 | | |
36 | 57 | | |
37 | 58 | | |
38 | 59 | | |
39 | 60 | | |
40 | 61 | | |
41 | | - | |
| 62 | + | |
42 | 63 | | |
43 | 64 | | |
44 | 65 | | |
| |||
141 | 162 | | |
142 | 163 | | |
143 | 164 | | |
144 | | - | |
| 165 | + | |
145 | 166 | | |
146 | 167 | | |
147 | 168 | | |
148 | | - | |
| 169 | + | |
149 | 170 | | |
150 | 171 | | |
151 | 172 | | |
| |||
156 | 177 | | |
157 | 178 | | |
158 | 179 | | |
159 | | - | |
| 180 | + | |
160 | 181 | | |
161 | 182 | | |
162 | 183 | | |
163 | | - | |
| 184 | + | |
164 | 185 | | |
165 | 186 | | |
166 | 187 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
45 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
| |||
0 commit comments