SRI Ada tasking benchmarks - part 3 of 3
Joe Orost
joe at petsd.UUCP
Thu Dec 13 01:27:28 AEST 1984
<>
#!/bin/sh
cat >order100.ada <<'------ EOF ------'
-- ada tasking tester
-- task head is the controller
-- tasks link are the chain of tasks
-- tasks idle are the standby tasks
with text_io; use text_io;
procedure test is
cycles: integer;
printon: boolean;
answer: character;
task head;
task link1 is
entry give1;
entry give2;
entry give3;
entry give4;
entry give5;
entry give6;
entry give7;
entry give8;
entry give9;
entry give10;
entry give11;
entry give12;
entry give13;
entry give14;
entry give15;
entry give16;
entry give17;
entry give18;
entry give19;
entry give20;
entry give21;
entry give22;
entry give23;
entry give24;
entry give25;
entry give26;
entry give27;
entry give28;
entry give29;
entry give30;
entry give31;
entry give32;
entry give33;
entry give34;
entry give35;
entry give36;
entry give37;
entry give38;
entry give39;
entry give40;
entry give41;
entry give42;
entry give43;
entry give44;
entry give45;
entry give46;
entry give47;
entry give48;
entry give49;
entry give50;
entry give51;
entry give52;
entry give53;
entry give54;
entry give55;
entry give56;
entry give57;
entry give58;
entry give59;
entry give60;
entry give61;
entry give62;
entry give63;
entry give64;
entry give65;
entry give66;
entry give67;
entry give68;
entry give69;
entry give70;
entry give71;
entry give72;
entry give73;
entry give74;
entry give75;
entry give76;
entry give77;
entry give78;
entry give79;
entry give80;
entry give81;
entry give82;
entry give83;
entry give84;
entry give85;
entry give86;
entry give87;
entry give88;
entry give89;
entry give90;
entry give91;
entry give92;
entry give93;
entry give94;
entry give95;
entry give96;
entry give97;
entry give98;
entry give99;
entry give100;
end link1;
task body head is
begin
put("do you want printing (y/n)? ");
get(answer);
put("answer is "); put(answer); put_line(" ");
if answer='y' then
printon := true;
else
printon := false;
end if;
if printon then put_line("printing on"); else put_line("print off");
end if;
put("how many cycles? ");
-- doesn't work get_line(cycles);
cycles := 100;
put_line("started");
for i in 1..cycles loop
if printon then put_line("head"); end if;
link1.give1;
link1.give2;
link1.give3;
link1.give4;
link1.give5;
link1.give6;
link1.give7;
link1.give8;
link1.give9;
link1.give10;
link1.give11;
link1.give12;
link1.give13;
link1.give14;
link1.give15;
link1.give16;
link1.give17;
link1.give18;
link1.give19;
link1.give20;
link1.give21;
link1.give22;
link1.give23;
link1.give24;
link1.give25;
link1.give26;
link1.give27;
link1.give28;
link1.give29;
link1.give30;
link1.give31;
link1.give32;
link1.give33;
link1.give34;
link1.give35;
link1.give36;
link1.give37;
link1.give38;
link1.give39;
link1.give40;
link1.give41;
link1.give42;
link1.give43;
link1.give44;
link1.give45;
link1.give46;
link1.give47;
link1.give48;
link1.give49;
link1.give50;
link1.give51;
link1.give52;
link1.give53;
link1.give54;
link1.give55;
link1.give56;
link1.give57;
link1.give58;
link1.give59;
link1.give60;
link1.give61;
link1.give62;
link1.give63;
link1.give64;
link1.give65;
link1.give66;
link1.give67;
link1.give68;
link1.give69;
link1.give70;
link1.give71;
link1.give72;
link1.give73;
link1.give74;
link1.give75;
link1.give76;
link1.give77;
link1.give78;
link1.give79;
link1.give80;
link1.give81;
link1.give82;
link1.give83;
link1.give84;
link1.give85;
link1.give86;
link1.give87;
link1.give88;
link1.give89;
link1.give90;
link1.give91;
link1.give92;
link1.give93;
link1.give94;
link1.give95;
link1.give96;
link1.give97;
link1.give98;
link1.give99;
link1.give100;
end loop;
put_line("ended");
end head;
task body link1 is
begin
loop
select
accept give1 do null; end give1;
or accept give2 do null; end give2;
or accept give3 do null; end give3;
or accept give4 do null; end give4;
or accept give5 do null; end give5;
or accept give6 do null; end give6;
or accept give7 do null; end give7;
or accept give8 do null; end give8;
or accept give9 do null; end give9;
or accept give10 do null; end give10;
or accept give11 do null; end give11;
or accept give12 do null; end give12;
or accept give13 do null; end give13;
or accept give14 do null; end give14;
or accept give15 do null; end give15;
or accept give16 do null; end give16;
or accept give17 do null; end give17;
or accept give18 do null; end give18;
or accept give19 do null; end give19;
or accept give20 do null; end give20;
or accept give21 do null; end give21;
or accept give22 do null; end give22;
or accept give23 do null; end give23;
or accept give24 do null; end give24;
or accept give25 do null; end give25;
or accept give26 do null; end give26;
or accept give27 do null; end give27;
or accept give28 do null; end give28;
or accept give29 do null; end give29;
or accept give30 do null; end give30;
or accept give31 do null; end give31;
or accept give32 do null; end give32;
or accept give33 do null; end give33;
or accept give34 do null; end give14;
or accept give35 do null; end give35;
or accept give36 do null; end give36;
or accept give37 do null; end give37;
or accept give38 do null; end give38;
or accept give39 do null; end give39;
or accept give40 do null; end give40;
or accept give41 do null; end give41;
or accept give42 do null; end give42;
or accept give43 do null; end give43;
or accept give44 do null; end give44;
or accept give45 do null; end give45;
or accept give46 do null; end give46;
or accept give47 do null; end give47;
or accept give48 do null; end give48;
or accept give49 do null; end give49;
or accept give50 do null; end give50;
or accept give51 do null; end give51;
or accept give52 do null; end give52;
or accept give53 do null; end give53;
or accept give54 do null; end give54;
or accept give55 do null; end give55;
or accept give56 do null; end give56;
or accept give57 do null; end give57;
or accept give58 do null; end give58;
or accept give59 do null; end give59;
or accept give60 do null; end give60;
or accept give61 do null; end give61;
or accept give62 do null; end give62;
or accept give63 do null; end give63;
or accept give64 do null; end give64;
or accept give65 do null; end give65;
or accept give66 do null; end give66;
or accept give67 do null; end give67;
or accept give68 do null; end give68;
or accept give69 do null; end give69;
or accept give70 do null; end give70;
or accept give71 do null; end give71;
or accept give72 do null; end give72;
or accept give73 do null; end give73;
or accept give74 do null; end give74;
or accept give75 do null; end give75;
or accept give76 do null; end give76;
or accept give77 do null; end give77;
or accept give78 do null; end give78;
or accept give79 do null; end give79;
or accept give80 do null; end give80;
or accept give81 do null; end give81;
or accept give82 do null; end give82;
or accept give83 do null; end give83;
or accept give84 do null; end give84;
or accept give85 do null; end give85;
or accept give86 do null; end give86;
or accept give87 do null; end give87;
or accept give88 do null; end give88;
or accept give89 do null; end give89;
or accept give90 do null; end give90;
or accept give91 do null; end give91;
or accept give92 do null; end give92;
or accept give93 do null; end give93;
or accept give94 do null; end give94;
or accept give95 do null; end give95;
or accept give96 do null; end give96;
or accept give97 do null; end give97;
or accept give98 do null; end give98;
or accept give99 do null; end give99;
or accept give100 do null; end give100;
end select;
end loop;
end link1;
begin
null;
end test;
------ EOF ------
ls -l order100.ada
cat >order31.ada <<'------ EOF ------'
-- ada tasking tester
-- task head is the controller
-- tasks link are the chain of tasks
-- tasks idle are the standby tasks
with text_io; use text_io;
procedure test is
cycles: integer;
printon: boolean;
answer: character;
task head;
task link1 is
entry give1;
entry give2;
entry give3;
entry give4;
entry give5;
entry give6;
entry give7;
entry give8;
entry give9;
entry give10;
entry give11;
entry give12;
entry give13;
entry give14;
entry give15;
entry give16;
entry give17;
entry give18;
entry give19;
entry give20;
entry give21;
entry give22;
entry give23;
entry give24;
entry give25;
entry give26;
entry give27;
entry give28;
entry give29;
entry give30;
entry give31;
end link1;
task body head is
begin
put("do you want printing (y/n)? ");
get(answer);
put("answer is "); put(answer); put_line(" ");
if answer='y' then
printon := true;
else
printon := false;
end if;
if printon then put_line("printing on"); else put_line("print off");
end if;
put("how many cycles? ");
-- doesn't work get_line(cycles);
cycles := 100;
put_line("started");
for i in 1..cycles loop
if printon then put_line("head"); end if;
link1.give1;
link1.give2;
link1.give3;
link1.give4;
link1.give5;
link1.give6;
link1.give7;
link1.give8;
link1.give9;
link1.give10;
link1.give11;
link1.give12;
link1.give13;
link1.give14;
link1.give15;
link1.give16;
link1.give17;
link1.give18;
link1.give19;
link1.give20;
link1.give21;
link1.give22;
link1.give23;
link1.give24;
link1.give25;
link1.give26;
link1.give27;
link1.give28;
link1.give29;
link1.give30;
link1.give31;
end loop;
put_line("ended");
end head;
task body link1 is
begin
loop
select
accept give1 do null; end give1;
or accept give2 do null; end give2;
or accept give3 do null; end give3;
or accept give4 do null; end give4;
or accept give5 do null; end give5;
or accept give6 do null; end give6;
or accept give7 do null; end give7;
or accept give8 do null; end give8;
or accept give9 do null; end give9;
or accept give10 do null; end give10;
or accept give11 do null; end give11;
or accept give12 do null; end give12;
or accept give13 do null; end give13;
or accept give14 do null; end give14;
or accept give15 do null; end give15;
or accept give16 do null; end give16;
or accept give17 do null; end give17;
or accept give18 do null; end give18;
or accept give19 do null; end give19;
or accept give20 do null; end give20;
or accept give21 do null; end give21;
or accept give22 do null; end give22;
or accept give23 do null; end give23;
or accept give24 do null; end give24;
or accept give25 do null; end give25;
or accept give26 do null; end give26;
or accept give27 do null; end give27;
or accept give28 do null; end give28;
or accept give29 do null; end give29;
or accept give30 do null; end give30;
or accept give31 do null; end give31;
end select;
end loop;
end link1;
begin
null;
end test;
------ EOF ------
ls -l order31.ada
cat >order31r.ada <<'------ EOF ------'
-- ada tasking tester
-- task head is the controller
-- tasks link are the chain of tasks
-- tasks idle are the standby tasks
with text_io; use text_io;
procedure test is
cycles: integer;
printon: boolean;
answer: character;
task head;
task link1 is
entry give1;
entry give2;
entry give3;
entry give4;
entry give5;
entry give6;
entry give7;
entry give8;
entry give9;
entry give10;
entry give11;
entry give12;
entry give13;
entry give14;
entry give15;
entry give16;
entry give17;
entry give18;
entry give19;
entry give20;
entry give21;
entry give22;
entry give23;
entry give24;
entry give25;
entry give26;
entry give27;
entry give28;
entry give29;
entry give30;
entry give31;
end link1;
task body head is
begin
put("do you want printing (y/n)? ");
get(answer);
put("answer is "); put(answer); put_line(" ");
if answer='y' then
printon := true;
else
printon := false;
end if;
if printon then put_line("printing on"); else put_line("print off");
end if;
put("how many cycles? ");
-- doesn't work get_line(cycles);
cycles := 100;
put_line("started");
for i in 1..cycles loop
if printon then put_line("head"); end if;
link1.give31;
link1.give30;
link1.give29;
link1.give28;
link1.give27;
link1.give26;
link1.give25;
link1.give24;
link1.give23;
link1.give22;
link1.give21;
link1.give20;
link1.give19;
link1.give18;
link1.give17;
link1.give16;
link1.give15;
link1.give14;
link1.give13;
link1.give12;
link1.give11;
link1.give10;
link1.give9;
link1.give8;
link1.give7;
link1.give6;
link1.give5;
link1.give4;
link1.give3;
link1.give2;
link1.give1;
end loop;
put_line("ended");
end head;
task body link1 is
begin
loop
select
accept give1 do null; end give1;
or accept give2 do null; end give2;
or accept give3 do null; end give3;
or accept give4 do null; end give4;
or accept give5 do null; end give5;
or accept give6 do null; end give6;
or accept give7 do null; end give7;
or accept give8 do null; end give8;
or accept give9 do null; end give9;
or accept give10 do null; end give10;
or accept give11 do null; end give11;
or accept give12 do null; end give12;
or accept give13 do null; end give13;
or accept give14 do null; end give14;
or accept give15 do null; end give15;
or accept give16 do null; end give16;
or accept give17 do null; end give17;
or accept give18 do null; end give18;
or accept give19 do null; end give19;
or accept give20 do null; end give20;
or accept give21 do null; end give21;
or accept give22 do null; end give22;
or accept give23 do null; end give23;
or accept give24 do null; end give24;
or accept give25 do null; end give25;
or accept give26 do null; end give26;
or accept give27 do null; end give27;
or accept give28 do null; end give28;
or accept give29 do null; end give29;
or accept give30 do null; end give30;
or accept give31 do null; end give31;
end select;
end loop;
end link1;
begin
null;
end test;
------ EOF ------
ls -l order31r.ada
cat >order32.ada <<'------ EOF ------'
-- ada tasking tester
-- task head is the controller
-- tasks link are the chain of tasks
-- tasks idle are the standby tasks
with text_io; use text_io;
procedure test is
cycles: integer;
printon: boolean;
answer: character;
task head;
task link1 is
entry give1;
entry give2;
entry give3;
entry give4;
entry give5;
entry give6;
entry give7;
entry give8;
entry give9;
entry give10;
entry give11;
entry give12;
entry give13;
entry give14;
entry give15;
entry give16;
entry give17;
entry give18;
entry give19;
entry give20;
entry give21;
entry give22;
entry give23;
entry give24;
entry give25;
entry give26;
entry give27;
entry give28;
entry give29;
entry give30;
entry give31;
entry give32;
end link1;
task body head is
begin
put("do you want printing (y/n)? ");
get(answer);
put("answer is "); put(answer); put_line(" ");
if answer='y' then
printon := true;
else
printon := false;
end if;
if printon then put_line("printing on"); else put_line("print off");
end if;
put("how many cycles? ");
-- doesn't work get_line(cycles);
cycles := 100;
put_line("started");
for i in 1..cycles loop
if printon then put_line("head"); end if;
link1.give1;
link1.give2;
link1.give3;
link1.give4;
link1.give5;
link1.give6;
link1.give7;
link1.give8;
link1.give9;
link1.give10;
link1.give11;
link1.give12;
link1.give13;
link1.give14;
link1.give15;
link1.give16;
link1.give17;
link1.give18;
link1.give19;
link1.give20;
link1.give21;
link1.give22;
link1.give23;
link1.give24;
link1.give25;
link1.give26;
link1.give27;
link1.give28;
link1.give29;
link1.give30;
link1.give31;
link1.give32;
end loop;
put_line("ended");
end head;
task body link1 is
begin
loop
select
accept give1 do null; end give1;
or accept give2 do null; end give2;
or accept give3 do null; end give3;
or accept give4 do null; end give4;
or accept give5 do null; end give5;
or accept give6 do null; end give6;
or accept give7 do null; end give7;
or accept give8 do null; end give8;
or accept give9 do null; end give9;
or accept give10 do null; end give10;
or accept give11 do null; end give11;
or accept give12 do null; end give12;
or accept give13 do null; end give13;
or accept give14 do null; end give14;
or accept give15 do null; end give15;
or accept give16 do null; end give16;
or accept give17 do null; end give17;
or accept give18 do null; end give18;
or accept give19 do null; end give19;
or accept give20 do null; end give20;
or accept give21 do null; end give21;
or accept give22 do null; end give22;
or accept give23 do null; end give23;
or accept give24 do null; end give24;
or accept give25 do null; end give25;
or accept give26 do null; end give26;
or accept give27 do null; end give27;
or accept give28 do null; end give28;
or accept give29 do null; end give29;
or accept give30 do null; end give30;
or accept give31 do null; end give31;
or accept give32 do null; end give32;
end select;
end loop;
end link1;
begin
null;
end test;
------ EOF ------
ls -l order32.ada
cat >passarryb.ada <<'------ EOF ------'
-- ada tasking tester
-- task head is the controller
-- tasks link are the chain of tasks
-- tasks idle are the standby tasks
with text_io; use text_io;
procedure test is
cycles: integer;
printon: boolean;
answer: character;
-- 32000 is biggest char arry legal
type param_type is array(1..32000) of integer;
task head is
entry give(p:in param_type);
end head;
task link1 is
entry give(p:in param_type);
end link1;
task body head is
p : param_type;
begin
put("do you want printing (y/n)? ");
get(answer);
put("answer is "); put(answer); put_line(" ");
if answer='y' then
printon := true;
else
printon := false;
end if;
if printon then put_line("printing on"); else put_line("print off");
end if;
put("how many cycles? ");
-- doesn't work get_line(cycles);
cycles := 10000;
put_line("started");
for i in 1..cycles loop
if printon then put_line("head"); end if;
link1.give(p);
accept give(p:in param_type) do
null;
end give;
end loop;
put_line("ended");
end head;
task body link1 is
p: param_type;
begin
loop
accept give(p:in param_type) do
null;
end give;
if printon then put_line("link1"); end if;
head.give(p);
end loop;
end link1;
begin
null;
end test;
------ EOF ------
ls -l passarryb.ada
cat >passarrys.ada <<'------ EOF ------'
-- ada tasking tester
-- task head is the controller
-- tasks link are the chain of tasks
-- tasks idle are the standby tasks
with text_io; use text_io;
procedure test is
cycles: integer;
printon: boolean;
answer: character;
type param_type is array(1..2) of character;
task head is
entry give(p:in param_type);
end head;
task link1 is
entry give(p:in param_type);
end link1;
task body head is
p : param_type;
begin
put("do you want printing (y/n)? ");
get(answer);
put("answer is "); put(answer); put_line(" ");
if answer='y' then
printon := true;
else
printon := false;
end if;
if printon then put_line("printing on"); else put_line("print off");
end if;
put("how many cycles? ");
-- doesn't work get_line(cycles);
cycles := 10000;
put_line("started");
for i in 1..cycles loop
if printon then put_line("head"); end if;
link1.give(p);
accept give(p:in param_type) do
null;
end give;
end loop;
put_line("ended");
end head;
task body link1 is
p: param_type;
begin
loop
accept give(p:in param_type) do
null;
end give;
if printon then put_line("link1"); end if;
head.give(p);
end loop;
end link1;
begin
null;
end test;
------ EOF ------
ls -l passarrys.ada
cat >passinout.ada <<'------ EOF ------'
-- ada tasking tester
-- task head is the controller
-- tasks link are the chain of tasks
-- tasks idle are the standby tasks
with text_io; use text_io;
procedure test is
cycles: integer;
printon: boolean;
answer: character;
-- 32000 is biggest char arry legal
type param_type is array(1..32000) of integer;
task head is
entry give(p:in out param_type);
end head;
task link1 is
entry give(p:in out param_type);
end link1;
task body head is
p : param_type;
begin
put("do you want printing (y/n)? ");
get(answer);
put("answer is "); put(answer); put_line(" ");
if answer='y' then
printon := true;
else
printon := false;
end if;
if printon then put_line("printing on"); else put_line("print off");
end if;
put("how many cycles? ");
-- doesn't work get_line(cycles);
cycles := 10000;
put_line("started");
for i in 1..cycles loop
if printon then put_line("head"); end if;
link1.give(p);
accept give(p:in out param_type) do
null;
end give;
end loop;
put_line("ended");
end head;
task body link1 is
p: param_type;
begin
loop
accept give(p:in out param_type) do
null;
end give;
if printon then put_line("link1"); end if;
head.give(p);
end loop;
end link1;
begin
null;
end test;
------ EOF ------
ls -l passinout.ada
cat >schedtest.ada <<'------ EOF ------'
-- schedtest : see if any tasks get starved
--
-- t1----------->slave<------------t3
-- t2----------->
--
-- t1 & t2 call entry1 in slave, t3 calls entry2
-- slave aborts after entered 1000 times
with text_io; use text_io;
procedure test is
cycles: integer;
printon: boolean;
answer: character;
call1: integer;
call2: integer;
task slave is
entry entry1;
entry entry2;
end slave;
task t1 is end t1;
task t2 is end t2;
task t3 is end t3;
task body t3 is
begin
loop
if printon then put_line("t3"); end if;
slave.entry2;
end loop;
end t3;
task body slave is
begin
put("do you want printing (y/n)? ");
get(answer);
put("answer is "); put(answer); put_line(" ");
if answer='y' then
printon := true;
else
printon := false;
end if;
if printon then put_line("printing on"); else put_line("print off");
end if;
call1 := 0;
call2 := 0;
put("how many cycles? ");
-- doesn't work get_line(cycles);
cycles := 1000;
put_line("started");
for i in 1..cycles loop
select
accept entry1 do
call1 := call1 + 1;
if printon then put_line("slave entry1"); end if;
end entry1;
or
accept entry2 do
call2 := call2 + 1;
if printon then put_line("slave entry2"); end if;
end entry2;
end select;
end loop;
put_line("ended");
-- put("entry1=");
-- put(call1);
-- put(" entry2=");
-- put(call2);
end slave;
task body t1 is
begin
loop
if printon then put_line("t1"); end if;
slave.entry1;
end loop;
end t1;
task body t2 is
begin
loop
if printon then put_line("t2"); end if;
slave.entry1;
end loop;
end t2;
begin
null;
end test;
------ EOF ------
ls -l schedtest.ada
cat >select2.ada <<'------ EOF ------'
-- ada tasking tester
-- task head is the controller
-- tasks link are the chain of tasks
-- tasks idle are the standby tasks
with text_io; use text_io;
procedure test is
cycles: integer;
printon: boolean;
answer: character;
task head is
entry give;
end head;
task link1 is
entry give;
entry s2;
end link1;
task body head is
begin
put("do you want printing (y/n)? ");
get(answer);
put("answer is "); put(answer); put_line(" ");
if answer='y' then
printon := true;
else
printon := false;
end if;
if printon then put_line("printing on"); else put_line("print off");
end if;
put("how many cycles? ");
-- doesn't work get_line(cycles);
cycles := 1000;
put_line("started");
for i in 1..cycles loop
if printon then put_line("head"); end if;
link1.give;
accept give do
null;
end give;
end loop;
put_line("ended");
end head;
task body link1 is
begin
loop
select
accept give do
null;
end give;
or accept s2 do null; end s2;
end select;
if printon then put_line("link1"); end if;
head.give;
end loop;
end link1;
begin
null;
end test;
------ EOF ------
ls -l select2.ada
cat >select20.ada <<'------ EOF ------'
-- ada tasking tester
-- task head is the controller
-- tasks link are the chain of tasks
-- tasks idle are the standby tasks
with text_io; use text_io;
procedure test is
cycles: integer;
printon: boolean;
answer: character;
task head is
entry give;
end head;
task link1 is
entry give;
entry s2;
entry s3;
entry s4;
entry s5;
entry s6;
entry s7;
entry s8;
entry s9;
entry s10;
entry s11;
entry s12;
entry s13;
entry s14;
entry s15;
entry s16;
entry s17;
entry s18;
entry s19;
entry s20;
end link1;
task body head is
begin
put("do you want printing (y/n)? ");
get(answer);
put("answer is "); put(answer); put_line(" ");
if answer='y' then
printon := true;
else
printon := false;
end if;
if printon then put_line("printing on"); else put_line("print off");
end if;
put("how many cycles? ");
-- doesn't work get_line(cycles);
cycles := 1000;
put_line("started");
for i in 1..cycles loop
if printon then put_line("head"); end if;
link1.give;
accept give do
null;
end give;
end loop;
put_line("ended");
end head;
task body link1 is
begin
loop
select
accept give do
null;
end give;
or accept s2 do null; end s2;
or accept s3 do null; end s3;
or accept s4 do null; end s4;
or accept s5 do null; end s5;
or accept s6 do null; end s6;
or accept s7 do null; end s7;
or accept s8 do null; end s8;
or accept s9 do null; end s9;
or accept s10 do null; end s10;
or accept s11 do null; end s11;
or accept s12 do null; end s12;
or accept s13 do null; end s13;
or accept s14 do null; end s14;
or accept s15 do null; end s15;
or accept s16 do null; end s16;
or accept s17 do null; end s17;
or accept s18 do null; end s18;
or accept s19 do null; end s19;
or accept s20 do null; end s20;
end select;
if printon then put_line("link1"); end if;
head.give;
end loop;
end link1;
begin
null;
end test;
------ EOF ------
ls -l select20.ada
cat >select2e.ada <<'------ EOF ------'
-- ada tasking tester
-- task head is the controller
-- tasks link are the chain of tasks
-- tasks idle are the standby tasks
with text_io; use text_io;
procedure test is
cycles: integer;
printon: boolean;
answer: character;
task head is
entry give;
end head;
task link1 is
entry give;
entry s2;
end link1;
task body head is
begin
put("do you want printing (y/n)? ");
get(answer);
put("answer is "); put(answer); put_line(" ");
if answer='y' then
printon := true;
else
printon := false;
end if;
if printon then put_line("printing on"); else put_line("print off");
end if;
put("how many cycles? ");
-- doesn't work get_line(cycles);
cycles := 1000;
put_line("started");
for i in 1..cycles loop
if printon then put_line("head"); end if;
link1.give;
accept give do
null;
end give;
end loop;
put_line("ended");
end head;
task body link1 is
begin
loop
select
accept s2 do null; end s2;
or accept give do
null;
end give;
end select;
if printon then put_line("link1"); end if;
head.give;
end loop;
end link1;
begin
null;
end test;
------ EOF ------
ls -l select2e.ada
More information about the Comp.sources.unix
mailing list