Commit ed924e2
committed
Fix deadlock: ensure workers always remove from runningThreads on cancellation
When AbortBackgroundRecalc() is called before DoBackgroundRecalcDisplayList
creates recalcDone, the abort cannot signal it. If workers subsequently see
the cancellation at the early-exit checks and return without removing
themselves from runningThreads, recalcDone.Count never reaches zero and
recalcDone.Set() is never called, causing WaitOne() to block forever and
t.Join() to hang indefinitely.
Move the lock(runningThreads) cleanup block outside the cancellation guard
so every queued worker unconditionally removes itself from runningThreads
and signals recalcDone when it is the last one — regardless of whether it
performed any actual work.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bFdnkBE83221SmUkyXHze1 parent f7aae9c commit ed924e2
1 file changed
Lines changed: 16 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | 153 | | |
166 | 154 | | |
167 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
168 | 172 | | |
169 | 173 | | |
170 | 174 | | |
| |||
0 commit comments