home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gnat-2.06-src.tgz / tar.out / fsf / gnat / ada / a-sytaco.ads < prev    next >
Text File  |  1996-09-28  |  2KB  |  57 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME COMPONENTS                          --
  4. --                                                                          --
  5. --         A D A . S Y N C H R O N O U S _ T A S K _ C O N T R O L          --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.6 $                              --
  10. --                                                                          --
  11. -- This specification is adapted from the Ada Reference Manual for use with --
  12. -- GNAT.  In accordance with the copyright of that document, you can freely --
  13. -- copy and modify this specification,  provided that if you redistribute a --
  14. -- modified version,  any changes that you have made are clearly indicated. --
  15. --                                                                          --
  16. ------------------------------------------------------------------------------
  17.  
  18. with System;
  19.  
  20. package Ada.Synchronous_Task_Control is
  21.  
  22.    type Suspension_Object is limited private;
  23.  
  24.    procedure Set_True (S : in out Suspension_Object);
  25.  
  26.    procedure Set_False (S : in out Suspension_Object);
  27.  
  28.    function Current_State (S : Suspension_Object) return Boolean;
  29.  
  30.    procedure Suspend_Until_True (S : in out Suspension_Object);
  31.  
  32. private
  33.  
  34.    --  ??? Suspension_Object is implemented as a record with a single
  35.    --      protected object field.  This is to program around a bug
  36.    --      in GNAT, which does not like limited private types
  37.    --      to be completed with a protected object.  Such a definition
  38.    --      will compile, but its use kills the compiler.
  39.  
  40.    --  ??? Using a protected object is overkill; suspension could be
  41.    --      implemented more efficiently.
  42.  
  43.    protected type Suspension_PO is
  44.       entry Wait;
  45.       procedure Set_False;
  46.       procedure Set_True;
  47.       function Get_Open return Boolean;
  48.    private
  49.       Open : Boolean := False;
  50.    end Suspension_PO;
  51.  
  52.    type Suspension_Object is record
  53.       Suspend : Suspension_PO;
  54.    end record;
  55.  
  56. end Ada.Synchronous_Task_Control;
  57.