mirror of https://github.com/tongzx/nt5src
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
34 lines
576 B
/*++
|
|
|
|
Copyright (C) 1996-2001 Microsoft Corporation
|
|
|
|
Module Name:
|
|
|
|
TLS.H
|
|
|
|
Abstract:
|
|
|
|
Thread Local Storage
|
|
|
|
History:
|
|
|
|
--*/
|
|
|
|
#ifndef __WBEM_TLS__H_
|
|
#define __WBEM_TLS__H_
|
|
|
|
class CTLS
|
|
{
|
|
protected:
|
|
DWORD m_dwIndex;
|
|
public:
|
|
inline CTLS() {m_dwIndex = TlsAlloc();}
|
|
inline ~CTLS() {TlsFree(m_dwIndex);}
|
|
inline void* Get()
|
|
{return ((m_dwIndex==0xFFFFFFFF)?NULL:TlsGetValue(m_dwIndex));}
|
|
inline void Set(void* p)
|
|
{if(m_dwIndex != 0xFFFFFFFF) TlsSetValue(m_dwIndex, p);}
|
|
inline BOOL IsValid() {return (m_dwIndex != 0xFFFFFFFF);}
|
|
};
|
|
|
|
#endif
|