/// <summary> /// Create a new Reaper with the given thread-id. /// This will have a new Poller with the name "reaper-" + thread-id, and a Mailbox of that same name. /// </summary> /// <param name="ctx">the Ctx for this to be in</param> /// <param name="threadId">an integer id to give to the thread this will live on</param> public Reaper([NotNull] Ctx ctx, int threadId) : base(ctx, threadId) { m_sockets = 0; m_terminating = false; string name = "reaper-" + threadId; m_poller = new Utils.Poller(name); m_mailbox = new Mailbox(name); m_mailboxHandle = m_mailbox.Handle; m_poller.AddHandle(m_mailboxHandle, this); m_poller.SetPollIn(m_mailboxHandle); }
/// <summary> /// Create a new SocketBase within the given Ctx, with the specified thread-id and socket-id. /// </summary> /// <param name="parent">the Ctx context that this socket will live within</param> /// <param name="threadId">the id of the thread upon which this socket will execute</param> /// <param name="socketId">the integer id for the new socket</param> protected SocketBase([NotNull] Ctx parent, int threadId, int socketId) : base(parent, threadId) { m_options.SocketId = socketId; m_mailbox = new Mailbox("socket-" + socketId); }