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.

44 lines
612 B

  1. //
  2. // ciccs.h
  3. //
  4. #ifndef CICCS_H
  5. #define CICCS_H
  6. class CCicCriticalSectionStatic
  7. {
  8. public:
  9. BOOL Init()
  10. {
  11. m_fInit = FALSE;
  12. if (InitializeCriticalSectionAndSpinCount(&m_cs, 0))
  13. {
  14. m_fInit = TRUE;
  15. }
  16. return m_fInit;
  17. }
  18. void Delete()
  19. {
  20. if (m_fInit)
  21. {
  22. DeleteCriticalSection(&m_cs);
  23. m_fInit = FALSE;
  24. }
  25. }
  26. operator CRITICAL_SECTION*()
  27. {
  28. return &m_cs;
  29. }
  30. private:
  31. CRITICAL_SECTION m_cs;
  32. BOOL m_fInit;
  33. };
  34. #endif CICCS_H