]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/tls.h
1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: OS/2 implementation of wxTlsValue<>
7 // Copyright: (c) 2008 Stefan Neis
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_OS2_TLS_H_
12 #define _WX_OS2_TLS_H_
14 #include "wx/os2/private.h"
16 // ----------------------------------------------------------------------------
17 // wxTlsKey is a helper class encapsulating a TLS slot
18 // ----------------------------------------------------------------------------
23 // ctor allocates a new key
26 APIRET rc
= ::DosAllocThreadLocalMemory(1, &m_slot
);
31 // return true if the key was successfully allocated
32 bool IsOk() const { return m_slot
!= NULL
; }
34 // get the key value, there is no error return
37 return (void *)m_slot
;
40 // change the key value, return true if ok
43 m_slot
= (ULONG
*)value
;
51 ::DosFreeThreadLocalMemory(m_slot
);
57 DECLARE_NO_COPY_CLASS(wxTlsKey
)
60 #endif // _WX_OS2_TLS_H_