-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement a timeout for PSEUDOCONSOLE_INHERIT_CURSOR #17574
Conversation
return _encounteredWin32InputModeSequence; | ||
// Technically we should decrement the timeout with each iteration, | ||
// but I suspect infinite spurious wake-ups are a theoretical problem. | ||
while (!_lookingForDSR.load(std::memory_order::relaxed)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this condition need to go the other way? We want to atomic_wait
while _lookingForDSR
is true
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done my brain in trying to figure this out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh look @zadjii-msft! Dustin found the actual source of the bug. 😅
It's not that it timeouts, but rather that it doesn't wait for the answer to begin with.
@@ -57,79 +43,67 @@ VtInputThread::VtInputThread(_In_ wil::unique_hfile hPipe, | |||
// - The return value of the underlying instance's _InputThread | |||
DWORD WINAPI VtInputThread::StaticVtInputThreadProc(_In_ LPVOID lpParameter) | |||
{ | |||
const auto pInstance = reinterpret_cast<VtInputThread*>(lpParameter); | |||
const auto pInstance = static_cast<VtInputThread*>(lpParameter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff in this file is a lot smaller with suppressed whitespace changes: https://github.com/microsoft/terminal/pull/17574/files?w=1
This implements a 3s timeout for cursor inheritance which prevents
ConPTY from being deadlocked at startup, if the terminal misbehaves.
It serves another purpose, however, in that it prepares the code for
the introduction of overlapped IO in #17510.
Closes #11213