-- Chapter 29 - Programming example 2 with Ada.Text_IO; use Ada.Text_IO; procedure CH29_2 is task type SHORT_LINE is end SHORT_LINE; task type LONG_LINE is end LONG_LINE; type LONG_POINT is access LONG_LINE; Cow, Dog, Pig : SHORT_LINE; Elephant, Hippopotamus : LONG_POINT; Horse : LONG_POINT := new 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"); Elephant := new LONG_LINE; Hippopotamus := new LONG_LINE; end CH29_2; -- The task named Horse will begin execution at the same time -- that the main body of the program begins execution. -- Exception never handled - program_error -- Result of execution -- This is an example of use of a task type -- This is a short line -- This is a short line -- This is a short line -- This is a short line -- This is a short line -- This is a short line -- This is a much longer line to be displayed -- This is a short line -- This is a short line -- This is a short line -- This is a much longer line to be displayed -- This is a short line -- This is a short line -- This is a short line -- This is a much longer line to be displayed -- This is a much longer line to be displayed -- This is a much longer line to be displayed -- This is a much longer line to be displayed