Commit 9c123d1
committed
Race condition in resume_foreground(DispatcherQueue)
It's possible for the lambda to run before control
returns to the caller of TryEnqueue. This led to async_suspend
accessing m_queued after it has already been destroyed
by the lambda.
We make the lambda responsible for setting m_queued prior to
resuming the coroutine. The lambda can infer that the task
was queued by the fact that the lambda is running at all!
If the enqueue fails, then m_queued remains at its initial
value of false.1 parent ae03783 commit 9c123d1
1 file changed
+2
-4
lines changed| 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 | | - | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
37 | | - | |
38 | 36 | | |
39 | 37 | | |
40 | 38 | | |
| |||
0 commit comments