| | |
| | | **
|
| | | ****************************************************************************/
|
| | |
|
| | | 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;
|
| | |
| | | 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; }
|
| | |
| | | if (state != value) {
|
| | | var oldState = state;
|
| | | state = value;
|
| | | Task.Run(() => sink.NotifyStateTransition(this, oldState, value));
|
| | | _ = Task.Run(() => sink.NotifyStateTransition(this, oldState, value));
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | {
|
| | | 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) {
|
| | |
| | | {
|
| | | if (State != DebugClientState.Unavailable) {
|
| | | NativeMethods.DebugClientShutdown(client);
|
| | | clientThread.Wait();
|
| | |
|
| | | QtVsToolsPackage.Instance.JoinableTaskFactory.Run(
|
| | | async () => await Task.WhenAll(new[] { clientThread }));
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | 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();
|
| | |
| | |
|
| | | uint timeout = (uint)QtVsToolsPackage.Instance.Options.QmlDebuggerTimeout;
|
| | | if (timeout != 0) {
|
| | | Task.Run(() =>
|
| | | _ = Task.Run(() =>
|
| | | {
|
| | | var connectTimer = new System.Diagnostics.Stopwatch();
|
| | | connectTimer.Start();
|