Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.2 KiB

  1. /*
  2. *
  3. * NOTES:
  4. *
  5. * REVISIONS:
  6. * rct 09Feb93 Made Equal() const
  7. * jwa 09FEB93 Changed return types for Wait and TimedWait to CHAR
  8. * Added theClosingFlag to be used to signal when the destructor has been called
  9. * rct 20Apr93 Changed return types, added some comments
  10. * cad27May93 added contant apc_semaphore
  11. * cad09Jul93: re-wrote as event semaphore
  12. *
  13. * pcy08Apr94: Trim size, use static iterators, dead code removal
  14. */
  15. #ifndef __SEMAPHOR_H
  16. #define __SEMAPHOR_H
  17. #include "cdefine.h"
  18. #include "_defs.h"
  19. #include "apc.h"
  20. #include "apcobj.h"
  21. _CLASSDEF( Semaphore )
  22. class Semaphore : public Obj {
  23. protected:
  24. public:
  25. Semaphore() : Obj() {};
  26. virtual INT Post() = 0;
  27. virtual INT Clear() = 0;
  28. virtual INT Pulse() {INT err = Post(); Clear(); return err;};
  29. virtual INT IsPosted() = 0;
  30. virtual INT Wait() {return TimedWait(-1L);};// wait indefinitely
  31. #if (C_OS & C_NLM)
  32. virtual INT TimedWait( SLONG aTimeOut ) = 0;// 0, <0 (block), n>0
  33. #else
  34. virtual INT TimedWait( LONG aTimeOut ) = 0;// 0, <0 (block), n>0
  35. #endif
  36. };
  37. #endif