Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        //  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();
        }
Exemplo n.º 4
0
        //  When migrating an object from one I/O thread to another, first
        //  unplug it, then migrate it, then plug it to the new thread.
        public void Plug(IOThread ioThread)
        {
            Debug.Assert(ioThread != null);
            Debug.Assert(m_poller == null);

            //  Retrieve the poller from the thread we are running in.
            m_poller = ioThread.GetPoller ();
        }
Exemplo n.º 5
0
        public void Unplug()
        {
            Debug.Assert(m_poller != null);

            //  Forget about old poller in preparation to be migrated
            //  to a different I/O thread.
            m_poller = null;
            m_handler = null;
        }