public MailboxNode <T> Add(string id, Action remove) { var newNode = new MailboxNode <T>(id, this, Next, remove); Next.Previous = newNode; Next = newNode; return(newNode); }
public MailboxNode(string id, MailboxNode <T> previous, MailboxNode <T> next, Action remove) { Id = id; Mailbox = new Mailbox <T>(id); Previous = previous; Next = next; Remove = remove; }
public MailboxManager(Action <string, T> actor) { Actor = actor; Root = new MailboxNode <T>(() => RemoveMailboxFromDictionary("")); Mailboxes = new ExclusiveConcurrentDictionary <string, MailboxNode <T> >(); Mailboxes.ReadOrWrite("", () => Root); Tasks = new List <Task>(); Tasks.Add(SpawnTask()); Running = true; }