]>
Commit | Line | Data |
---|---|---|
acad886c VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/private/threadinfo.h | |
3 | // Purpose: declaration of wxThreadSpecificInfo: thread-specific information | |
4 | // Author: Vadim Zeitlin | |
5 | // Created: 2009-07-13 | |
acad886c VZ |
6 | // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> |
7 | // Licence: wxWindows licence | |
8 | /////////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef _WX_PRIVATE_THREADINFO_H_ | |
11 | #define _WX_PRIVATE_THREADINFO_H_ | |
12 | ||
92c0fc34 | 13 | #include "wx/defs.h" |
acad886c VZ |
14 | |
15 | class WXDLLIMPEXP_FWD_BASE wxLog; | |
16 | ||
d2740de5 VS |
17 | #if wxUSE_INTL |
18 | #include "wx/hashset.h" | |
19 | WX_DECLARE_HASH_SET(wxString, wxStringHash, wxStringEqual, | |
20 | wxLocaleUntranslatedStrings); | |
21 | #endif | |
22 | ||
23 | ||
acad886c VZ |
24 | // ---------------------------------------------------------------------------- |
25 | // wxThreadSpecificInfo: contains all thread-specific information used by wx | |
26 | // ---------------------------------------------------------------------------- | |
27 | ||
92c0fc34 VS |
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 | |
acad886c | 32 | { |
92c0fc34 VS |
33 | public: |
34 | // Return this thread's instance. | |
35 | static wxThreadSpecificInfo& Get(); | |
36 | ||
53ff8df7 VZ |
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 | |
39 | // logger) | |
acad886c | 40 | wxLog *logger; |
53ff8df7 VZ |
41 | |
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) | |
44 | // | |
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 | |
47 | // logging | |
48 | bool loggingDisabled; | |
acad886c | 49 | |
d2740de5 VS |
50 | #if wxUSE_INTL |
51 | // Storage for wxTranslations::GetUntranslatedString() | |
52 | wxLocaleUntranslatedStrings untranslatedStrings; | |
53 | #endif | |
54 | ||
52784696 VS |
55 | #if wxUSE_THREADS |
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(); | |
60 | #endif | |
61 | ||
92c0fc34 VS |
62 | private: |
63 | wxThreadSpecificInfo() : logger(NULL), loggingDisabled(false) {} | |
64 | }; | |
acad886c | 65 | |
92c0fc34 | 66 | #define wxThreadInfo wxThreadSpecificInfo::Get() |
acad886c VZ |
67 | |
68 | #endif // _WX_PRIVATE_THREADINFO_H_ | |
69 |