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.

26 lines
473 B

  1. #pragma once
  2. #ifdef __ATLCOM_H__ //--- Only enable these if ATL is being used
  3. class CSPAutoCritSecLock
  4. {
  5. protected:
  6. CComAutoCriticalSection* m_pSec;
  7. public:
  8. CSPAutoCritSecLock(CComAutoCriticalSection* pSec)
  9. {
  10. m_pSec = pSec;
  11. m_pSec->Lock();
  12. };
  13. ~CSPAutoCritSecLock()
  14. {
  15. m_pSec->Unlock();
  16. };
  17. };
  18. #define SPAUTO_SEC_LOCK( s ) CSPAutoCritSecLock lck##__LINE__(s);
  19. #endif // __ATLCOM_H__