From ca47896204482bf4a6979e3838bf7f09f61cebeb Mon Sep 17 00:00:00 2001 From: giy <giy@omp-system.ru> Date: Fri, 02 Sep 2022 14:16:56 +0300 Subject: [PATCH] Обновление до версии 2.9.0 --- QtVsTools.Package/QML/Debugging/V4/QmlDebugV4Client.cs | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-) diff --git a/QtVsTools.Package/QML/Debugging/V4/QmlDebugV4Client.cs b/QtVsTools.Package/QML/Debugging/V4/QmlDebugV4Client.cs index abbf6de..19f88f2 100644 --- a/QtVsTools.Package/QML/Debugging/V4/QmlDebugV4Client.cs +++ b/QtVsTools.Package/QML/Debugging/V4/QmlDebugV4Client.cs @@ -26,14 +26,9 @@ ** ****************************************************************************/ -using QtVsTools.Options; using System; -using System.Collections.Concurrent; -using System.IO; using System.Net.Sockets; using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Runtime.Serialization.Json; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -62,7 +57,7 @@ IConnectionEventSink sink; IntPtr client; Task clientThread; - EventWaitHandle clientCreated = new EventWaitHandle(false, EventResetMode.ManualReset); + readonly EventWaitHandle clientCreated = new EventWaitHandle(false, EventResetMode.ManualReset); EventWaitHandle clientConnected; public uint? ThreadId { get; private set; } @@ -82,7 +77,7 @@ if (state != value) { var oldState = state; state = value; - Task.Run(() => sink.NotifyStateTransition(this, oldState, value)); + _ = Task.Run(() => sink.NotifyStateTransition(this, oldState, value)); } } } @@ -100,14 +95,17 @@ { this.sink = sink; - Task.WaitAny(new[] + QtVsToolsPackage.Instance.JoinableTaskFactory.Run(async () => { - // Try to start client thread - // Unblock if thread was abruptly terminated (e.g. DLL not found) - clientThread = Task.Run(() => ClientThread()), + await Task.WhenAny(new[] + { + // Try to start client thread + // Unblock if thread was abruptly terminated (e.g. DLL not found) + clientThread = Task.Run(() => ClientThread()), - // Unblock if client was created (i.e. client thread is running) - Task.Run(() => clientCreated.WaitOne()) + // Unblock if client was created (i.e. client thread is running) + Task.Run(() => clientCreated.WaitOne()) + }); }); if (State == DebugClientState.Unavailable) { @@ -135,7 +133,9 @@ { if (State != DebugClientState.Unavailable) { NativeMethods.DebugClientShutdown(client); - clientThread.Wait(); + + QtVsToolsPackage.Instance.JoinableTaskFactory.Run( + async () => await Task.WhenAll(new[] { clientThread })); } } @@ -180,7 +180,7 @@ var hostNameData = Encoding.UTF8.GetBytes(hostName); uint timeout = (uint)QtVsToolsPackage.Instance.Options.QmlDebuggerTimeout; - Task.Run(() => + _ = Task.Run(() => { var connectTimer = new System.Diagnostics.Stopwatch(); connectTimer.Start(); @@ -246,7 +246,7 @@ uint timeout = (uint)QtVsToolsPackage.Instance.Options.QmlDebuggerTimeout; if (timeout != 0) { - Task.Run(() => + _ = Task.Run(() => { var connectTimer = new System.Diagnostics.Stopwatch(); connectTimer.Start(); -- Gitblit v1.9.1