Source code of Windows XP (NT5)
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.

34 lines
576 B

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. TLS.H
  5. Abstract:
  6. Thread Local Storage
  7. History:
  8. --*/
  9. #ifndef __WBEM_TLS__H_
  10. #define __WBEM_TLS__H_
  11. class CTLS
  12. {
  13. protected:
  14. DWORD m_dwIndex;
  15. public:
  16. inline CTLS() {m_dwIndex = TlsAlloc();}
  17. inline ~CTLS() {TlsFree(m_dwIndex);}
  18. inline void* Get()
  19. {return ((m_dwIndex==0xFFFFFFFF)?NULL:TlsGetValue(m_dwIndex));}
  20. inline void Set(void* p)
  21. {if(m_dwIndex != 0xFFFFFFFF) TlsSetValue(m_dwIndex, p);}
  22. inline BOOL IsValid() {return (m_dwIndex != 0xFFFFFFFF);}
  23. };
  24. #endif