home *** CD-ROM | disk | FTP | other *** search
- -- Chapter 27 - Programming exercise 1
- with Text_IO;
- use Text_IO;
-
- procedure CH27_1 is
-
- task type SHORT_LINE is
- end SHORT_LINE;
-
- task type LONG_LINE is
- end LONG_LINE;
-
- Cow : array (1..17) of SHORT_LINE;
- Elephant, Hippopotamus : LONG_LINE;
-
- task body SHORT_LINE is
- begin
- for Index in 1..4 loop
- delay 0.0;
- Put_Line("This is a short line");
- end loop;
- end SHORT_LINE;
-
- task body LONG_LINE is
- begin
- for Index in 1..3 loop
- delay 0.0;
- Put_Line("This is a much longer line to be displayed");
- end loop;
- end LONG_LINE;
-
- begin
- Put_Line("This is an example of use of a task type array");
- end CH27_1;
-
-
-
-
- -- Result of execution
-
- -- This is an example of use of a task type
- -- The output is similar to the program TASKARRY.ADA but there
- -- is a lot more of it.
-
- -- Note that 17 was the largest number that could be used for
- -- the number of tasks and still execute properly. When the
- -- number 18 is used, a storage_error exception is generated.
- -- This is for one compiler, and the number could vary over a
- -- rather large range for different compilers.
-
-