]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/tls.h
1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: Win32 implementation of wxTlsValue<>
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_MSW_TLS_H_
12 #define _WX_MSW_TLS_H_
14 #include "wx/msw/wrapwin.h"
16 // ----------------------------------------------------------------------------
17 // wxTlsKey is a helper class encapsulating a TLS slot
18 // ----------------------------------------------------------------------------
23 // ctor allocates a new key
26 m_slot
= ::TlsAlloc();
29 // return true if the key was successfully allocated
30 bool IsOk() const { return m_slot
!= TLS_OUT_OF_INDEXES
; }
32 // get the key value, there is no error return
35 return ::TlsGetValue(m_slot
);
38 // change the key value, return true if ok
41 return ::TlsSetValue(m_slot
, value
) != 0;
54 wxDECLARE_NO_COPY_CLASS(wxTlsKey
);
57 #endif // _WX_MSW_TLS_H_