public IOThread(Ctx ctx, int tid) : base(ctx, tid) { m_name = "iothread-" + tid; m_poller = new Poller(m_name); m_mailbox = new Mailbox(m_name); m_mailboxHandle = m_mailbox.FD; m_poller.AddFD (m_mailboxHandle, this); m_poller.SetPollin (m_mailboxHandle); }
public Reaper(Ctx ctx, int tid) : base(ctx, tid) { m_sockets = 0; m_terminating = false; m_name = "reaper-" + tid; m_poller = new Poller(m_name); mailbox = new Mailbox(m_name); m_mailboxHandle = mailbox.FD; m_poller.AddFD (m_mailboxHandle, this); m_poller.SetPollin (m_mailboxHandle); }
// Using this function reaper thread ask the socket to register with // its poller. public void StartReaping(Poller poller) { // Plug the socket to the reaper thread. m_poller = poller; m_handle = m_mailbox.FD; m_poller.AddFD(m_handle, this); m_poller.SetPollin(m_handle); // Initialise the termination and check whether it can be deallocated // immediately. Terminate(); CheckDestroy(); }