/// <summary> /// Spawns a new thread which listens for asynchronous messages from the remote q host. /// If a listener thread already exists, nothing happens. /// </summary> public virtual void StartListener() { lock (this) { if (listener == null) { listener = new QListener(this); listenerThread = new Thread(listener.Run); listenerThread.Start(); } } }
/// <summary> /// Indicates that a listener thread should stop. The listener thread is stopped after receiving next message from the /// remote q host. /// If a listener doesn't exists, nothing happens. /// </summary> public virtual void StopListener() { lock (this) { if (_listener == null) { return; } _listener.Running = false; _listenerThread.Join(500); _listener = null; } }
/// <summary> /// Spawns a new thread which listens for asynchronous messages from the remote q host. /// If a listener thread already exists, nothing happens. /// </summary> public virtual void StartListener() { lock (this) { if (_listener != null) { return; } _listener = new QListener(this); _listenerThread = new Thread(_listener.Run); _listenerThread.Start(); } }
/// <summary> /// Indicates that a listener thread should stop. The listener thread is stopped after receiving next message from the remote q host. /// If a listener doesn't exists, nothing happens. /// </summary> public virtual void StopListener() { lock (this) { if (listener != null) { listener.Running = false; listenerThread.Join(500); listener = null; } } }