AddHandle() public méthode

Add a new PollSet containing the given Socket and IPollEvents at the next iteration through the loop, and also add the Socket to the list of those to check for errors.
public AddHandle ( [ handle, [ events ) : void
handle [ the Socket to add
events [ the IPollEvents to include in the new PollSet to add
Résultat void
Exemple #1
0
        /// <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);
        }
Exemple #2
0
        /// <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);
        }
Exemple #3
0
        /// <summary>
        /// Using this function reaper thread ask the socket to register with
        /// its poller.
        /// </summary>
        internal void StartReaping([NotNull] Poller poller)
        {
            // Plug the socket to the reaper thread.
            m_poller = poller;
            m_handle = m_mailbox.Handle;
            m_poller.AddHandle(m_handle, this);
            m_poller.SetPollIn(m_handle);

            // Initialise the termination and check whether it can be deallocated
            // immediately.
            Terminate();
            CheckDestroy();
        }