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.

45 lines
775 B

  1. ////////////////////////////////////////////////
  2. // Atomics.h
  3. #ifndef __ATOMICS_H__
  4. #define __ATOMICS_H__
  5. void AtomicInit();
  6. void AtomicTerm();
  7. // Returns true if val at zero and siezed
  8. bool AtomicSeizeToken( long &lVal );
  9. // Returns true if val at non-zero and released
  10. bool AtomicReleaseToken( long &lVal );
  11. class CAtomicList
  12. {
  13. public:
  14. typedef enum tag_ListAccess_t
  15. {
  16. LIST_READ,
  17. LIST_WRITE,
  18. } ListAccess;
  19. // Construction
  20. public:
  21. CAtomicList();
  22. ~CAtomicList();
  23. // Members
  24. protected:
  25. long m_lCount;
  26. DWORD m_dwThreadID;
  27. CRITICAL_SECTION m_crit;
  28. HANDLE m_hEvent;
  29. // Implemetation
  30. public:
  31. bool Lock( short nType, DWORD dwTimeOut = INFINITE );
  32. void Unlock( short nType );
  33. };
  34. #endif // __ATOMICS_H__