From:	SCOVCB::GALVIN_FX    31-JAN-1989 09:04
To:	ARISIA::EVERHART
Subj:	

with TEXT_IO ; use TEXT_IO ;
with UTILITY; 
with SIMULATION;
with RESOURCES; 

procedure EXAMPLE2 is

   package MESS is new RESOURCES.MESSAGES.MESSAGE_CREATOR (integer);
   MSG : RESOURCES.MESSAGES.MESSAGE;
   CUST_JOB, TEL_JOB : SIMULATION.PROCESS;

   task type CUSTOMER;
   task type TELLER;

   package P1 is new SIMULATION.PROCESS_CREATOR ("CUSTOMER", CUSTOMER, integer);
   package P2 is new SIMULATION.PROCESS_CREATOR ("TELLER  ", TELLER, integer);

   task body CUSTOMER is
   begin
      RESOURCES.MESSAGES.OUTPUT_MESSAGE_REPORT;
      RESOURCES.MESSAGES.OUTPUT_MESSAGE_DUMP;
      MESS.SEND_MESSAGE (MSG, 1);
      SIMULATION.DELAY_PROCESS (2.0);
      RESOURCES.MESSAGES.OUTPUT_MESSAGE_REPORT;
      RESOURCES.MESSAGES.OUTPUT_MESSAGE_DUMP;
      MESS.SEND_MESSAGE (MSG, 2);
      P1.DESTROY_PROCESS;
   end CUSTOMER;

   task body TELLER is
      I : integer;
   begin
      MESS.RECEIVE_MESSAGE (MSG, I);
      RESOURCES.MESSAGES.OUTPUT_MESSAGE_DUMP;
      MESS.RECEIVE_MESSAGE (MSG, I);
      P2.DESTROY_PROCESS;
   end TELLER;

begin
   put_line ("EXAMPLE2 ADASIM MODEL - TRACE, REPORT AND DUMP MESSAGES");
   new_line;
   SIMULATION.SET_PROCESS_TRACE_OPTION (UTILITY.ON);
   RESOURCES.MESSAGES.SET_MESSAGE_TRACE_OPTION (UTILITY.ON);
   RESOURCES.MESSAGES.SET_MESSAGE_DUMP_OPTION (UTILITY.ON);

   RESOURCES.MESSAGES.CREATE_MESSAGE (MSG, "MESSAGE");

   P2.CREATE_PROCESS (TEL_JOB, "TELLER1", 0.0, 0.0, 0);
   P1.CREATE_PROCESS (CUST_JOB, "CUST1", 1.0, 0.0, 0);

   SIMULATION.START_SIMULATION;
   RESOURCES.OUTPUT_RESOURCE_REPORTS;
end EXAMPLE2;
