1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/private/threadinfo.h
3 // Purpose: declaration of wxThreadSpecificInfo: thread-specific information
4 // Author: Vadim Zeitlin
6 // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_PRIVATE_THREADINFO_H_
11 #define _WX_PRIVATE_THREADINFO_H_
15 class WXDLLIMPEXP_FWD_BASE wxLog
;
18 #include "wx/hashset.h"
19 WX_DECLARE_HASH_SET(wxString
, wxStringHash
, wxStringEqual
,
20 wxLocaleUntranslatedStrings
);
24 // ----------------------------------------------------------------------------
25 // wxThreadSpecificInfo: contains all thread-specific information used by wx
26 // ----------------------------------------------------------------------------
28 // Group all thread-specific information we use (e.g. the active wxLog target)
29 // a in this class to avoid consuming more TLS slots than necessary as there is
30 // only a limited number of them.
31 class wxThreadSpecificInfo
34 // Return this thread's instance.
35 static wxThreadSpecificInfo
& Get();
37 // the thread-specific logger or NULL if the thread is using the global one
38 // (this is not used for the main thread which always uses the global
42 // true if logging is currently disabled for this thread (this is also not
43 // used for the main thread which uses wxLog::ms_doLog)
45 // NB: we use a counter-intuitive "disabled" flag instead of "enabled" one
46 // because the default, for 0-initialized struct, should be to enable
51 // Storage for wxTranslations::GetUntranslatedString()
52 wxLocaleUntranslatedStrings untranslatedStrings
;
56 // Cleans up storage for the current thread. Should be called when a thread
57 // is being destroyed. If it's not called, the only bad thing that happens
58 // is that the memory is deallocated later, on process termination.
59 static void ThreadCleanUp();
63 wxThreadSpecificInfo() : logger(NULL
), loggingDisabled(false) {}
66 #define wxThreadInfo wxThreadSpecificInfo::Get()
68 #endif // _WX_PRIVATE_THREADINFO_H_