From: Tom Deseyn Date: Thu, 27 Jun 2019 17:07:50 +0000 (+0200) Subject: dotnet-monitor: Use CommandHandler CancellationToken for SIGINT detection (#365) X-Git-Tag: submit/tizen/20190813.035844~4^2^2~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a87793919aed645d4594b3891de75904f1453d55;p=platform%2Fcore%2Fdotnet%2Fdiagnostics.git dotnet-monitor: Use CommandHandler CancellationToken for SIGINT detection (#365) --- diff --git a/src/Tools/dotnet-counters/CounterMonitor.cs b/src/Tools/dotnet-counters/CounterMonitor.cs index 399fe15d7..07003ef85 100644 --- a/src/Tools/dotnet-counters/CounterMonitor.cs +++ b/src/Tools/dotnet-counters/CounterMonitor.cs @@ -166,6 +166,8 @@ namespace Microsoft.Diagnostics.Tools.Counters } ManualResetEvent shouldExit = new ManualResetEvent(false); + _ct.Register(() => shouldExit.Set()); + var terminated = false; writer.InitializeDisplay(); @@ -194,10 +196,7 @@ namespace Microsoft.Diagnostics.Tools.Counters }); monitorTask.Start(); - Console.CancelKeyPress += (sender, args) => { - args.Cancel = true; - shouldExit.Set(); - }; + while(!shouldExit.WaitOne(250)) { while (true)