home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / lib / gcc-lib / m68k-amigaos / 2.7.2.1 / adainclude / s-os2syn.ads < prev    next >
Encoding:
Text File  |  1995-10-17  |  6.7 KB  |  207 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                 GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS               --
  4. --                                                                          --
  5. --        S Y S T E M . O S 2 L I B . S Y N C H R O N I Z A T I O N         --
  6. --                                                                          --
  7. --                                  S p e c                                 --
  8. --                                                                          --
  9. --                             $Revision: 1.7 $                             --
  10. --                                                                          --
  11. --          Copyright (c) 1993,1994,1995 NYU, All Rights Reserved           --
  12. --                                                                          --
  13. --  GNARL is free software; you can redistribute it and/or modify it  under --
  14. --  terms  of  the  GNU  Library General Public License as published by the --
  15. --  Free Software Foundation; either version 2,  or (at  your  option)  any --
  16. --  later  version.   GNARL is distributed in the hope that it will be use- --
  17. --  ful, but but WITHOUT ANY WARRANTY; without even the implied warranty of --
  18. --  MERCHANTABILITY  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Gen- --
  19. --  eral Library Public License for more details.  You should have received --
  20. --  a  copy of the GNU Library General Public License along with GNARL; see --
  21. --  file COPYING. If not, write to the Free Software Foundation,  675  Mass --
  22. --  Ave, Cambridge, MA 02139, USA.                                          --
  23. --                                                                          --
  24. ------------------------------------------------------------------------------
  25.  
  26. with Interfaces.C;
  27. with System;
  28. with System.OS2Lib.Threads;
  29.  
  30. package System.OS2Lib.Synchronization is
  31. pragma Preelaborate (Synchronization);
  32.  
  33.    use Interfaces.C;
  34.    use System;
  35.    use System.OS2Lib.Threads;
  36.  
  37.    --  Critical sections
  38.  
  39.    function DosEnterCritSec return APIRET;
  40.    pragma Import (C, DosEnterCritSec, "DosEnterCritSec");
  41.  
  42.    function DosExitCritSec return APIRET;
  43.    pragma Import (C, DosExitCritSec, "DosExitCritSec");
  44.  
  45.    --  Semaphore Attributes
  46.  
  47.    DC_SEM_SHARED : constant := 16#01#;
  48.    --  DosCreateMutex, DosCreateEvent, and DosCreateMuxWait use it to indicate
  49.    --  whether the semaphore is shared or private when the PSZ is null
  50.  
  51.    DCMW_WAIT_ANY : constant := 16#02#;
  52.    --  DosCreateMuxWait option for wait on any event/mutex to occur
  53.  
  54.    DCMW_WAIT_ALL : constant := 16#04#;
  55.    --  DosCreateMuxWait option for wait on all events/mutexes to occur
  56.  
  57.    SEM_INDEFINITE_WAIT  : constant ULONG := -1;
  58.    SEM_IMMEDIATE_RETURN : constant ULONG :=  0;
  59.  
  60.    type HSEM is new System.Address;
  61.    type PHSEM is access all HSEM;
  62.  
  63.    type SEMRECORD is
  64.       record
  65.          hsemCur : HSEM;
  66.          ulUser  : ULONG;
  67.       end record;
  68.    type PSEMRECORD is access all SEMRECORD;
  69.  
  70.  
  71.    type HEV is new unsigned_long;
  72.    type PHEV is access all HEV;
  73.  
  74.    type HMTX is new unsigned_long;
  75.    type PHMTX is access all HMTX;
  76.    type HMUX is new unsigned_long;
  77.    type PHMUX is access all HMUX;
  78.  
  79.    function DosCreateEventSem
  80.      (pszName   : PSZ;
  81.       f_phev    : PHEV;
  82.       flAttr    : ULONG;
  83.       fState    : BOOL32)
  84.       return      APIRET;
  85.    pragma Import (C, DosCreateEventSem, "DosCreateEventSem");
  86.  
  87.    function DosOpenEventSem
  88.      (pszName   : PSZ;
  89.       F_phev    : PHEV)
  90.       return      APIRET;
  91.    pragma Import (C, DosOpenEventSem, "DosOpenEventSem");
  92.  
  93.    function DosCloseEventSem
  94.      (F_hev     : HEV)
  95.       return      APIRET;
  96.    pragma Import (C, DosCloseEventSem, "DosCloseEventSem");
  97.  
  98.    function DosResetEventSem
  99.      (F_hev     : HEV;
  100.       pulPostCt : PULONG)
  101.       return      APIRET;
  102.    pragma Import (C, DosResetEventSem, "DosResetEventSem");
  103.  
  104.    function DosPostEventSem
  105.      (F_hev     : HEV)
  106.       return      APIRET;
  107.    pragma Import (C, DosPostEventSem, "DosPostEventSem");
  108.  
  109.    function DosWaitEventSem
  110.      (F_hev     : HEV;
  111.       ulTimeout : ULONG)
  112.       return      APIRET;
  113.    pragma Import (C, DosWaitEventSem, "DosWaitEventSem");
  114.  
  115.    function DosQueryEventSem
  116.      (F_hev     : HEV;
  117.       pulPostCt : PULONG)
  118.       return      APIRET;
  119.    pragma Import (C, DosQueryEventSem, "DosQueryEventSem");
  120.  
  121.    function DosCreateMutexSem
  122.      (pszName   : PSZ;
  123.       F_phmtx   : PHMTX;
  124.       flAttr    : ULONG;
  125.       fState    : BOOL32)
  126.       return      APIRET;
  127.    pragma Import (C, DosCreateMutexSem, "DosCreateMutexSem");
  128.  
  129.    function DosOpenMutexSem
  130.      (pszName   : PSZ;
  131.       F_phmtx   : PHMTX)
  132.       return      APIRET;
  133.    pragma Import (C, DosOpenMutexSem, "DosOpenMutexSem");
  134.  
  135.    function DosCloseMutexSem
  136.      (F_hmtx    : HMTX)
  137.       return      APIRET;
  138.    pragma Import (C, DosCloseMutexSem, "DosCloseMutexSem");
  139.  
  140.    function DosRequestMutexSem
  141.      (F_hmtx    : HMTX;
  142.       ulTimeout : ULONG)
  143.       return      APIRET;
  144.    pragma Import (C, DosRequestMutexSem, "DosRequestMutexSem");
  145.  
  146.    function DosReleaseMutexSem
  147.      (F_hmtx    : HMTX)
  148.       return      APIRET;
  149.    pragma Import (C, DosReleaseMutexSem, "DosReleaseMutexSem");
  150.  
  151.    function DosQueryMutexSem
  152.      (F_hmtx    : HMTX;
  153.       F_ppid    : PPID;
  154.       F_ptid    : PTID;
  155.       pulCount  : PULONG)
  156.       return      APIRET;
  157.    pragma Import (C, DosQueryMutexSem, "DosQueryMutexSem");
  158.  
  159.    function DosCreateMuxWaitSem
  160.      (pszName   : PSZ;
  161.       F_phmux   : PHMUX;
  162.       cSemRec   : ULONG;
  163.       pSemRec   : PSEMRECORD;
  164.       flAttr    : ULONG)
  165.       return      APIRET;
  166.    pragma Import (C, DosCreateMuxWaitSem, "DosCreateMuxWaitSem");
  167.  
  168.    function DosOpenMuxWaitSem
  169.      (pszName   : PSZ;
  170.       F_phmux   : PHMUX)
  171.       return      APIRET;
  172.    pragma Import (C, DosOpenMuxWaitSem, "DosOpenMuxWaitSem");
  173.  
  174.    function DosCloseMuxWaitSem
  175.      (F_hmux    : HMUX)
  176.       return      APIRET;
  177.    pragma Import (C, DosCloseMuxWaitSem, "DosCloseMuxWaitSem");
  178.  
  179.    function DosWaitMuxWaitSem
  180.      (F_hmux    : HMUX;
  181.       ulTimeout : ULONG;
  182.       pulUser   : PULONG)
  183.       return      APIRET;
  184.    pragma Import (C, DosWaitMuxWaitSem, "DosWaitMuxWaitSem");
  185.  
  186.    function DosAddMuxWaitSem
  187.      (F_hmux    : HMUX;
  188.       pSemRec   : PSEMRECORD)
  189.       return      APIRET;
  190.    pragma Import (C, DosAddMuxWaitSem, "DosAddMuxWaitSem");
  191.  
  192.    function DosDeleteMuxWaitSem
  193.      (F_hmux    : HMUX;
  194.       F_hsem    : HSEM)
  195.       return      APIRET;
  196.    pragma Import (C, DosDeleteMuxWaitSem, "DosDeleteMuxWaitSem");
  197.  
  198.    function DosQueryMuxWaitSem
  199.      (F_hmux    : HMUX;
  200.      pcSemRec   : PULONG;
  201.      pSemRec    : PSEMRECORD;
  202.      pflAttr    : PULONG)
  203.      return       APIRET;
  204.    pragma Import (C, DosQueryMuxWaitSem, "DosQueryMuxWaitSem");
  205.  
  206. end System.OS2Lib.Synchronization;
  207.