static void listenerThread(Object obj) { DSM dsm = (DSM)obj; while (true) { Console.WriteLine("Rank " + Communicator.world.Rank.ToString() + " waiting "); Msg msg = Communicator.world.Receive <Msg>(Communicator.anySource, Communicator.anyTag); if (msg.exit) { break; } if (msg.updateMsg != null) { Console.WriteLine("Rank " + Communicator.world.Rank + " received : " + msg.updateMsg.var + " -> " + msg.updateMsg.val); dsm.setVar(msg.updateMsg.var, msg.updateMsg.val); } if (msg.subscribeMsg != null) { Console.WriteLine("Rank " + Communicator.world.Rank + "received: " + msg.subscribeMsg.rank + " sub to " + msg.subscribeMsg.var); dsm.subscribeOther(msg.subscribeMsg.var, msg.subscribeMsg.rank); } writeVars(dsm); } }