public void ExecuteWithCommunication() { if (SelfSubmitter.AmIRootProcess()) { AsynchronousServer server = new AsynchronousServer(C.DEFAULT_PORT); AutoResetEvent receivedDone = new AutoResetEvent(false); server.NewMessageReceivedEvent += (objectRecv, sock) => { if (objectRecv is ISystemMessage hello) { hello.Dispatch(sock); } if (objectRecv is string s) { Console.Out.WriteLine(s); receivedDone.Set(); } }; server.Start(); //receivedDone.WaitOne(); SubmitNewCopyOfMyself(); while (true) { Thread.Sleep(1000); Console.Out.WriteLine("Received msgs so far: {0}", AsynchronousCommunicationUtils.reception); } } else if (SelfSubmitter.GetMyNestLevel() == 1) { ClientExample(); } }
public void Execute() { if (SelfSubmitter.AmIRootProcess()) { SubmitNewCopyOfMyself(); SubmitNewCopyOfMyself(); } else if (SelfSubmitter.GetMyNestLevel() == 1) { Console.Out.WriteLine("Hello from 1nd nest level"); SubmitNewCopyOfMyself(); } else if (SelfSubmitter.GetMyNestLevel() == 2) { Console.Out.WriteLine("Hello from 2nd nest level"); } }
public int Execute(string[] args) { if (SelfSubmitter.AmIRootProcess()) { return(DoTheParentJob()); } else if (SelfSubmitter.GetMyNestLevel() == 1) { // WARNING! I assume here that args are like follows: // string[] arguments = { "--model", modelFilesForTask[0], "--startpath", modelFilesForTask[1] }; // if this changes, modify those values string modelFilename = args[1]; string startPathFilename = args[3]; DoTheChildJob(modelFilename, startPathFilename); } return(0); }