public override void Invoke(MessagingRuntime rt, Mailbox mbox) { rt.Spawn(Self, () => Toaster(count)); mbox.Receive(); Console.WriteLine("Putting butter on the toast"); Console.WriteLine("Putting jam on the toast"); rt.Send(to, new BreakfastItem <Toast>(toast)); }
static void Main(string[] args) { var rt = new MessagingRuntime(); var cook = rt.Spawn(new Cook()); rt.Spawn(cook, () => EggFryer(2)); rt.Spawn(cook, () => BaconFryer(3)); rt.Spawn(new ToastMaker(cook, 2)); rt.Wait(); }
public override void Invoke(MessagingRuntime rt, Mailbox mbox) { Console.WriteLine("Pouring coffee"); Coffee cup = new Coffee(); Console.WriteLine("Pouring Coffee"); while (!doneEggs || !doneBacon || !doneToast) { mbox.Receive(); } Console.WriteLine("Pouring orange juice"); Juice oj = new Juice(); Console.WriteLine("oj is ready"); Console.WriteLine("Breakfast is ready!"); }