Exemplo n.º 1
0
        /// <summary>
        /// Create a new IOThread object within the given context (Ctx) and thread.
        /// </summary>
        /// <param name="ctx">the Ctx (context) for this thread to live within</param>
        /// <param name="threadId">the integer thread-id for this new IOThread</param>
        public IOThread([NotNull] Ctx ctx, int threadId)
            : base(ctx, threadId)
        {
            var name = "iothread-" + threadId;
            m_proactor = new Proactor(name);
            m_mailbox = new IOThreadMailbox(name, m_proactor, this);

#if DEBUG
            m_name = name;
#endif
        }
Exemplo n.º 2
0
        public IOThreadMailbox([NotNull] string name, [NotNull] Proactor proactor, [NotNull] IMailboxEvent mailboxEvent)
        {
            m_proactor = proactor;
            m_mailboxEvent = mailboxEvent;

            // Get the pipe into passive state. That way, if the users starts by
            // polling on the associated file descriptor it will get woken up when
            // new command is posted.
            Command cmd;
            bool ok = m_commandPipe.TryRead(out cmd);
            Debug.Assert(!ok);

#if DEBUG
            m_name = name;
#endif
        }