Rendez-Vous (I) in Ada

task body Server is
   Sum : Integer := 0;
begin loop
      accept Foo (Item : in Integer) 
        do Sum := Sum + Item; end Foo;
      accept Bar (Item : out Integer) 
        do Item := Sum; end Bar;
   end loop;      
end Server;
A : Server; B : Integer;
begin
   A.Foo (4); A.Bar (B); A.Foo (5); A.Bar (B);
end B;



Johannes Waldmann 2011-06-29