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

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