未验证 提交 bcd3aad9 编写于 作者: D David Fowler 提交者: GitHub

Fix another hang on shutdown (#51681)

* Fix another hang on shutdown
- If SIGINT/Ctrl+C fires don't block shutdown waiting for dispose. This mechanism was intended to be a way to let application code unwind completely before exiting the process but we can cancel the the CancelKeyPress today, which means we don't need to wait for dispose to be called.
- This is a change in behavior but I can't figure out a case where ProcessExit would fire and you'd want it to wait on a dispose call *after* SIGINT/CTRL+C has fired.
上级 827474bb
......@@ -93,6 +93,10 @@ private void OnCancelKeyPress(object sender, ConsoleCancelEventArgs e)
{
e.Cancel = true;
ApplicationLifetime.StopApplication();
// Don't block in process shutdown for CTRL+C/SIGINT since we can set e.Cancel to true
// we assume that application code will unwind once StopApplication signals the token
_shutdownBlock.Set();
}
public Task StopAsync(CancellationToken cancellationToken)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册