SIGN IN SIGN UP
microsoft / terminal UNCLAIMED

The new Windows Terminal and the original Windows console host, all in the same place!

0 0 91 C++

render: check the thread exit condition after every long operation (#20097)

We have received an internal report that teardown on OneCore is still
hanging. It looks like there's a chance that `TriggerTeardown` is called
during `PaintFrame`, which may result in `_threadShouldKeepRunning`
getting set to `false` (TriggerTeardown) and `_redraw` being set to
`false` as well (PaintFrame). The thread will wait forever on `_redraw`
to be signalled, which it never will, because `TriggerTeardown` is
waiting for the thread to exit.

That is:

```
Render Thread      | ConIoSrv Thread
------------------------------------
Check _enabled     |
Wait on _redraw    |
Check _keepRunning | TriggerTeardown
Paint              |   _keepRunning = false
                   |   _redraw = true
    _redraw = false|   Signal _enabled
Paint Completes    |   Wait on thread
Check _enabled     |
Wait on _redraw    |
**DEADLOCK**       | **DEADLOCK**
                   v
```

This may not be an ideal fix, but at least it checks
`_threadShouldKeepRunning` after every "long" operation (waiting and
painting) now.
D
Dustin L. Howett committed
a6ebdd3d4a2fd2c4815f75541e9346ec27a9c284
Parent: 031998b
Committed by GitHub <noreply@github.com> on 4/9/2026, 9:34:09 PM