public void AddSocket(AsyncSocket socket, IProactorEvents proactorEvents) { var item = new Item(proactorEvents); m_sockets.Add(socket, item); m_completionPort.AssociateSocket(socket, item); AdjustLoad(1); }
/// <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; }
/// <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); }
public Item([NotNull] IProactorEvents proactorEvents) { ProactorEvents = proactorEvents; Cancelled = false; }
public void SetHandler(IProactorEvents handler) { m_handler = handler; }
public Item([NotNull] IProactorEvents proactorEvents) => ProactorEvents = proactorEvents;
public void SetHandler([NotNull] IProactorEvents handler) { m_handler = handler; }
public Item(IProactorEvents proactorEvents) => ProactorEvents = proactorEvents;
/// <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); }
public void SetHandler( IProactorEvents handler) { m_handler = handler; }
public Item([NotNull] IProactorEvents proactorEvents) { this.ProactorEvents = proactorEvents; this.Cancelled = false; }
public Item(IProactorEvents proactorEvents) { ProactorEvents = proactorEvents; Cancelled = false; }
public Item( IProactorEvents proactorEvents) { ProactorEvents = proactorEvents; Cancelled = false; }