pdf - 395 K - Ecole des mines de Nantes
pdf - 395 K - Ecole des mines de Nantes
pdf - 395 K - Ecole des mines de Nantes
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
properties.expected."closed.");/// /// Sends a Message asynchronously in the context of this./// Reply can be <strong>de</strong>tected through the ExpectingReply and Reply/// Raises an exception if a reply to an AsyncSend is already/// /// /// /// public void AsyncSend(Message m, Agent ag){Monitor.Enter(aLock);CheckState();asyncReply = null;expectingMessage = true;agent = ag;agent.MessageArrived += asyncHandler;m.SetConversation(GetUpdatedClone());MessageTransporter.GetMT().PostMessage(m);Monitor.Exit(aLock);}/// /// Checks that a reply to an AsyncSend is not expected./// Called by SendAndWait and AsyncSend./// private void CheckState(){// Supposedly holding lock alreadyif (expectingMessage || currentState == States.CLOSED){Monitor.Exit(aLock);throw new Exception("Cannot send message because a}}+ "reply is expected or Conversation ispublic object Clone(){return new Conversation(this.i<strong>de</strong>ntifier,this.currentState);}/// /// Closes this, i.e. it becomes impossible to send Messages inthe context of/// this, and if a Message is expected after an AsyncSend thenit is ignored./// public void Close(){Monitor.Enter(aLock);if (expectingMessage){agent.MessageArrived -= asyncHandler;expectingMessage = false;}currentState = States.CLOSED;MSc EMOOSE Thesis – http://www.emn.fr/EMOOSE 92