示例#1
0
文件: Proactor.cs 项目: hdxhan/netmq
        public void AddSocket(AsyncSocket socket, IProactorEvents proactorEvents)
        {
            var item = new Item(proactorEvents);
            m_sockets.Add(socket, item);

            m_completionPort.AssociateSocket(socket, item);
            AdjustLoad(1);
        }
示例#2
0
        public void AddSocket(AsyncSocket socket, IProactorEvents proactorEvents)
        {
            var item = new Item(proactorEvents);

            m_sockets.Add(socket, item);

            m_completionPort.AssociateSocket(socket, item);
            AdjustLoad(1);
        }
示例#3
0
        /// <summary>
        /// "Un-Plug" this IOObject from its current IOThread, and set its handler to null.
        /// </summary>
        /// <remarks>
        /// When migrating an object from one I/O thread to another, first
        /// unplug it, then migrate it, then plug it to the new thread.
        /// </remarks>
        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;
        }
示例#4
0
文件: IOObject.cs 项目: cjkao/netmq
        /// <summary>
        /// "Un-Plug" this IOObject from its current IOThread, and set its handler to null.
        /// </summary>
        /// <remarks>
        /// When migrating an object from one I/O thread to another, first
        /// unplug it, then migrate it, then plug it to the new thread.
        /// </remarks>
        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;
        }
示例#5
0
        /// <summary>
        /// Add a <see cref="TimerInfo"/> to the internal list, created from the given sink and id - to expire in the given number of milliseconds.
        /// Afterward the expiration method TimerEvent on the sink object will be called with argument set to id.
        /// </summary>
        /// <param name="timeout">the timeout-period in milliseconds of the new timer</param>
        /// <param name="sink">the IProactorEvents to add for the sink of the new timer</param>
        /// <param name="id">the Id to assign to the new TimerInfo</param>
        public void AddTimer(long timeout, [NotNull] IProactorEvents sink, int id)
        {
            long expiration = Clock.NowMs() + timeout;
            var  info       = new TimerInfo(sink, id);

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

            m_timers[expiration].Add(info);
        }
示例#6
0
 public Item([NotNull] IProactorEvents proactorEvents)
 {
     ProactorEvents = proactorEvents;
     Cancelled      = false;
 }
示例#7
0
 public void SetHandler(IProactorEvents handler)
 {
     m_handler = handler;
 }
示例#8
0
 public Item([NotNull] IProactorEvents proactorEvents) => ProactorEvents = proactorEvents;
示例#9
0
文件: IOObject.cs 项目: cjkao/netmq
 public void SetHandler([NotNull] IProactorEvents handler)
 {
     m_handler = handler;
 }
示例#10
0
 public Item(IProactorEvents proactorEvents) => ProactorEvents = proactorEvents;
示例#11
0
文件: PollerBase.cs 项目: awb99/netmq
        /// <summary>
        /// Add a <see cref="TimerInfo"/> to the internal list, created from the given sink and id - to expire in the given number of milliseconds.
        /// Afterward the expiration method TimerEvent on the sink object will be called with argument set to id.
        /// </summary>
        /// <param name="timeout">the timeout-period in milliseconds of the new timer</param>
        /// <param name="sink">the IProactorEvents to add for the sink of the new timer</param>
        /// <param name="id">the Id to assign to the new TimerInfo</param>
        public void AddTimer(long timeout,  IProactorEvents sink, int id)
        {
            long expiration = Clock.NowMs() + timeout;
            var info = new TimerInfo(sink, id);

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

            m_timers[expiration].Add(info);
        }
示例#12
0
文件: IOObject.cs 项目: awb99/netmq
 public void SetHandler( IProactorEvents handler)
 {
     m_handler = handler;
 }
示例#13
0
 public void SetHandler([NotNull] IProactorEvents handler)
 {
     m_handler = handler;
 }
示例#14
0
 public Item([NotNull] IProactorEvents proactorEvents)
 {
     this.ProactorEvents = proactorEvents;
     this.Cancelled      = false;
 }
示例#15
0
 public Item(IProactorEvents proactorEvents)
 {
     ProactorEvents = proactorEvents;
     Cancelled      = false;
 }
示例#16
0
文件: Proactor.cs 项目: awb99/netmq
 public Item( IProactorEvents proactorEvents)
 {
     ProactorEvents = proactorEvents;
     Cancelled = false;
 }