public IOThread(Ctx ctx, int threadId) : base(ctx, threadId) { m_name = "iothread-" + threadId; m_proactor = new Proactor(m_name); m_mailbox = new IOThreadMailbox(m_name, m_proactor, this); }
/// <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 }
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. bool ok = m_commandPipe.TryRead(out Command cmd); Debug.Assert(!ok); #if DEBUG m_name = name; #endif }
public IOThreadMailbox([CanBeNull] string name, [NotNull] Proactor proactor, [NotNull] IMailboxEvent mailboxEvent) { m_proactor = proactor; m_mailboxEvent = mailboxEvent; m_cpipe = new YPipe <Command>(Config.CommandPipeGranularity, "mailbox"); m_sync = new object(); // 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. var cmd = new Command(); bool ok = m_cpipe.Read(ref cmd); Debug.Assert(!ok); m_name = name; m_disposed = false; }