Пример #1
0
        public Notifier(OnEntireData o)
        {
            _onMsgCB = o; // set on data callback
            _enabled = true;
            _exited  = new ManualResetEvent(false);
            _queue   = new Queue <NotificationMessage>();
            _sync    = ((ICollection)_queue).SyncRoot;

            ThreadPool.QueueUserWorkItem(
                state =>
            {
                while (_enabled || Count > 0)
                {
                    var msg = dequeue();
                    if (msg != null)
                    {
                        _onMsgCB(msg.ToString());
                    }
                    else
                    {
                        Thread.Sleep(500);
                    }
                }

                _exited.Set();
            }
                );
        }
Пример #2
0
 public ClientSocket(Dispatcher dis)
 {
     this.recv = dis.dispatchMsg;
     dis.send  = this.Send;
     onEventInit();
 }
Пример #3
0
 public Dispatcher(Handler handler)
 {
     this.recv           = handler.handleRecv;
     handler.sendHandler = this.sendMsg;
 }