/// <exception cref="Exception">Timeout starting lightstreamer thread</exception> public void Start() { var connLock = ConnLock; ClientStartStop execute; lock (connLock) { _phase++; execute = new ClientStartStop(_phase, this); } var gate = new ManualResetEvent(false); Exception ex = null; new Thread(delegate() { try { execute.DoStart(); } catch (Exception e) { ex = e; } gate.Set(); }) { Name = "LightStreamerStartThread" }.Start(); if (!gate.WaitOne(Settings.DefaultTimeoutMs + 1000)) { throw new Exception("Timeout starting lightstreamer thread"); } if (ex != null) { throw ex; } }
internal void Start() { ClientStartStop execute; lock (ConnLock) { _phase++; execute = new ClientStartStop(_phase, this); } Debug.WriteLine("About to Start Lightstreamer Client"); var gate = new ManualResetEvent(false); Exception ex = null; new Thread(() => { try { execute.DoStart(); } catch (Exception ex1) { ex = ex1; } gate.Set(); }) { Name = "LightStreamerStartThread" }.Start(); if (!gate.WaitOne(LightstreamerDefaults.DEFAULT_TIMEOUT_MS + 1000)) { throw new Exception("Timeout starting lightstreamer thread"); } if (ex != null) { throw ex; } }
internal void Stop() { ClientStartStop execute; lock (ConnLock) { _phase++; execute = new ClientStartStop(_phase, this); } Debug.WriteLine("About to Stop Lightstreamer Client"); var gate = new ManualResetEvent(false); var th = new Thread(() => { execute.DoStop(); gate.Set(); }) { Name = "LightStreamerStopThread" }; th.Start(); gate.WaitOne(); }
public void Stop() { var connLock = ConnLock; ClientStartStop execute; lock (connLock) { _phase++; execute = new ClientStartStop(_phase, this); } var gate = new ManualResetEvent(false); new Thread(delegate() { execute.DoStop(); gate.Set(); }) { Name = "LightStreamerStopThread" }.Start(); gate.WaitOne(); }