home *** CD-ROM | disk | FTP | other *** search
/ Chip 1995 March / CHIP3.mdf / programm / prog4 / tasktype.ada < prev    next >
Encoding:
Text File  |  1991-07-01  |  1.3 KB  |  61 lines

  1.                                      -- Chapter 27 - Program 1
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure TaskType is
  6.  
  7. task type SHORT_LINE is
  8. end SHORT_LINE;
  9.  
  10. task type LONG_LINE is
  11. end LONG_LINE;
  12.  
  13. Cow, Dog, Pig          : SHORT_LINE;
  14. Elephant, Hippopotamus : LONG_LINE;
  15.  
  16. task body SHORT_LINE is
  17. begin
  18.    for Index in 1..4 loop
  19.       delay 0.0;
  20.       Put_Line("This is a short line");
  21.    end loop;
  22. end SHORT_LINE;
  23.  
  24. task body LONG_LINE is
  25. begin
  26.    for Index in 1..3 loop
  27.       delay 0.0;
  28.       Put_Line("This is a much longer line to be displayed");
  29.    end loop;
  30. end LONG_LINE;
  31.  
  32. begin
  33.    Put_Line("This is an example of use of a task type");
  34. end TaskType;
  35.  
  36.  
  37.  
  38.  
  39. -- Result of execution
  40.  
  41. -- This is an example of use of a task type
  42. -- This is a much longer line to be displayed
  43. -- This is a much longer line to be displayed
  44. -- This is a short line
  45. -- This is a short line
  46. -- This is a short line
  47. -- This is a much longer line to be displayed
  48. -- This is a much longer line to be displayed
  49. -- This is a short line
  50. -- This is a short line
  51. -- This is a short line
  52. -- This is a much longer line to be displayed
  53. -- This is a much longer line to be displayed
  54. -- This is a short line
  55. -- This is a short line
  56. -- This is a short line
  57. -- This is a short line
  58. -- This is a short line
  59. -- This is a short line
  60.  
  61.