procedure LaMarsellesa is vendedores: array [0..3] of Vendedor; gustos: array [0..19] of GustoHelado; task GustoHelado is entry usarGusto; entry dejarGusto; end GustoHelado; task body GustoHelado is usando: boolean; begin usando := false; loop select when not usando => accept usarGusto usando := true; end usarGusto; or accept dejarGusto usando := false; end dejarGusto; end select; end loop; end GustoHelado; task Cliente is; task body Cliente is gusto: Gusto; i: integer; begin que_helado_quiero(gusto); Caja.dameVendedor(i); vendedores[i].dameHelado(gusto); comer_helado(); end Cliente; task type Vendedor is entry ident(i: in integer); entry dameHelado(gustoCli: Gusto); end Vendedor; task body Vendedor is gusto: Gusto; id: integer; begin accept ident(i: in integer) id := i; end ident; loop Caja.estoyLibre(id); accept dameHelado(gustoCli: in Gusto) gusto := gustoCli; end dameHelado; gustos[gusto].usarGusto; armar_helado(gusto); gustos[gusto].dejarGusto; entregar_o_recibir_helado(); end loop; end Vendedor; task Caja is entry dameVendedor(i: out integer); entry estoyLibre(i: in integer); end Caja; task body Caja is libreId: integer; begin loop accept estoyLibre(i: in integer) libreId := i; end estoyLibre; accept dameVendedor(i: out integer) i := libreId; end dameVendedor; end loop; end Caja; begin -- LaMarsellesa i: integer; for i in 0:3 loop vendedores[i].ident(i); end loop; end LaMarsellesa;