[*] Improve win32 stdin preemption on deinit
This commit is contained in:
parent
80d351472a
commit
c4ef27b01d
@ -479,18 +479,24 @@ namespace Aurora::Console::ConsoleStd
|
||||
#endif
|
||||
}
|
||||
|
||||
// Note: CloseHandle in the middle of a ReadFile blocks & we can't legally preempt without the support of docs
|
||||
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
||||
if (gWin32Thread != INVALID_HANDLE_VALUE)
|
||||
|
||||
if (IS_STREAM_HANDLE_VALID(gWin32Thread))
|
||||
{
|
||||
WaitForSingleObject(gWin32Thread, 200);
|
||||
TerminateThread(gWin32Thread, 0);
|
||||
CancelSynchronousIo(gWin32Thread);
|
||||
if (WaitForSingleObject(gWin32Thread, 200) != WAIT_OBJECT_0)
|
||||
{
|
||||
TerminateThread(gWin32Thread, 0);
|
||||
}
|
||||
}
|
||||
|
||||
AuWin32CloseHandle(gWin32Thread);
|
||||
AuWin32CloseHandle(gTerminateConsole);
|
||||
|
||||
// Note: CloseHandle in the middle of a ReadFile blocks
|
||||
AuWin32CloseHandle(gInputStream);
|
||||
AuWin32CloseHandle(gOutputStream);
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user