示例#1
0
        public void AddSocket(AsyncSocket socket, IProcatorEvents procatorEvents)
        {
            var item = new Item(procatorEvents);

            m_sockets.Add(socket, item);

            m_completionPort.AssociateSocket(socket, item);
            AdjustLoad(1);
        }
示例#2
0
        public void Unplug()
        {
            Debug.Assert(m_ioThread != null);

            //  Forget about old poller in preparation to be migrated
            //  to a different I/O thread.
            m_ioThread = null;
            m_handler  = null;
        }
示例#3
0
        //  Add a timeout to expire in timeout_ milliseconds. After the
        //  expiration timer_event on sink_ object will be called with
        //  argument set to id_.
        public void AddTimer(long timeout, IProcatorEvents sink, int id)
        {
            long      expiration = Clock.NowMs() + timeout;
            TimerInfo info       = new TimerInfo(sink, id);

            if (!m_timers.ContainsKey(expiration))
            {
                m_timers.Add(expiration, new List <TimerInfo>());
            }

            m_timers[expiration].Add(info);
        }
示例#4
0
 public Item(IProcatorEvents procatorEvents)
 {
     ProcatorEvents = procatorEvents;
     Cancelled      = false;
 }
示例#5
0
 public void SetHandler(IProcatorEvents handler)
 {
     this.m_handler = handler;
 }