// ----------------------------------------------------------------------- // The following module implements the sender. It sends messages with a // message tag "out_tag" by emitting the signal "send_message". It then // waits until a message is received, which is indicated by input event // "receive_message". If this happens, the tags "in_tag=out_tag" are // compared. If they are the same, the previously sent message is // acknowledged, otherwise the same message has to be sent once more. // ----------------------------------------------------------------------- package Communication.Stenning; module Sender( event ?receive_message, int ?in_tag, event !send_message, int out_tag, event !delivered) { out_tag = 0; loop{ emit(send_message); await(receive_message); if (in_tag==out_tag){ emit(delivered); next(out_tag) = (out_tag+1); } } }