public void UnlockMutex(IMailbox<object> me) { Safety.Assert(owner == me); owner = null; if (lockQueue.Count <= 0) return; owner = lockQueue[0]; lockQueue.RemoveAt(0); owner.Send(new object()); }
public void CheckMessages(IMailbox<string> res) { StringBuilder sb = new StringBuilder(); foreach (var m in _messages) { sb.Append($"From: {m.Item1};\n Message: {m.Item2}\n\n"); } res.Send(sb.ToString()); }
public void LockMutex(IMailbox<object> me) { if (owner == null) { owner = me; me.Send(new object()); return; } lockQueue.Add(me); }