Exemplo n.º 1
0
        /// <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;
            }
        }
Exemplo n.º 2
0
        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;
            }
        }