home *** CD-ROM | disk | FTP | other *** search
/ Informática Multimedia: Special Games / INFESPGAMES.mdf / os2 / ribble / support / cumtxsem.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-09  |  1022 b   |  48 lines

  1. // -------------------------------
  2. //  Name:           CUMtxSem.h
  3. //  Author:         J.R.Shannon
  4. //  Language:       C++
  5. //  Date:           7/11/92
  6. //  Revison:        2.0
  7. //  Last revision:  16/6/93
  8. //  Licence:        Public Domain
  9. //  Purpose:        Unnamed Mutex semaphore
  10. // -------------------------------
  11. //
  12.  
  13. #include <CSupport.h>
  14. #include <CAssert.h>
  15.  
  16. #ifndef _CUMtxSem_h
  17. #define _CUMtxSem_h
  18.  
  19.   #if defined(__OS2__)
  20.     #define INCL_DOSSEMAPHORES
  21.     #define INCL_NOPMAPI
  22.     #include <os2.h>
  23.     typedef APIRET CUMtxSemRet;
  24.     typedef HMTX CUMtxSemHMTX;
  25.     #define CUMtxSemWait SEM_INDEFINITE_WAIT
  26.   #else
  27.     typedef int CUMtxSemRet;
  28.     typedef int CUMtxSemHMTX;
  29.     typedef unsigned long ULONG;
  30.     #define CUMtxSemWait 0
  31.   #endif
  32.  
  33. class CSExport CUMtxSem
  34. {
  35. public:
  36.   CUMtxSem(void);
  37.   ~CUMtxSem();
  38.   CUMtxSemRet request(ULONG timeout = CUMtxSemWait) const;
  39.   void obtain(void) const;
  40.   void release(void) const;
  41.  
  42. private:
  43.   CUMtxSemHMTX  lock;
  44. };
  45.  
  46. #endif
  47.  
  48.