Skip to content

Synchronous Messaging

laforge49 edited this page Nov 17, 2011 · 7 revisions

When doing long computations or blocking I/O, there is a real advantage to asynchronous messaging. But synchronous messaging should be the default, because it is so much faster. This is implemented by the Exchange class, which runs the EchoTimingTest at about 94 nanoseconds per message and the BurstTimingTest at about 98 nanoseconds per message.

##ExchangeRequest

Request sent to an Exchange object must subclass ExchangeRequest.

/**
 * ExchangeRequest is used to support synchronous message passing between Exchanges.
 */
class ExchangeRequest(_sender: ExchangeMessengerSource, rf: Any => Unit)
  extends ExchangeMessengerRequest(_sender, rf) {

  /**
   * If a request is sent synchronously, fastSend is set to true.
   */
  var fastSend = false
}

ExchangeRequest

##Exchange

Exchange

Clone this wiki locally