Example #1
0
        public MailboxNode <T> Add(string id, Action remove)
        {
            var newNode = new MailboxNode <T>(id, this, Next, remove);

            Next.Previous = newNode;
            Next          = newNode;
            return(newNode);
        }
Example #2
0
 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;
 }
Example #3
0
 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;
 }