]>
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 | ||
13 | #if wxUSE_THREADS | |
14 | ||
15 | #include "wx/tls.h" | |
16 | ||
17 | class WXDLLIMPEXP_FWD_BASE wxLog; | |
18 | ||
19 | // ---------------------------------------------------------------------------- | |
20 | // wxThreadSpecificInfo: contains all thread-specific information used by wx | |
21 | // ---------------------------------------------------------------------------- | |
22 | ||
23 | // currently the only thread-specific information we use is the active wxLog | |
24 | // target but more could be added in the future (e.g. current wxLocale would be | |
25 | // a likely candidate) and we will group all of them in this struct to avoid | |
26 | // consuming more TLS slots than necessary as there is only a limited number of | |
27 | // them | |
28 | ||
29 | // NB: this must be a POD to be stored in TLS | |
30 | struct wxThreadSpecificInfo | |
31 | { | |
53ff8df7 VZ |
32 | // the thread-specific logger or NULL if the thread is using the global one |
33 | // (this is not used for the main thread which always uses the global | |
34 | // logger) | |
acad886c | 35 | wxLog *logger; |
53ff8df7 VZ |
36 | |
37 | // true if logging is currently disabled for this thread (this is also not | |
38 | // used for the main thread which uses wxLog::ms_doLog) | |
39 | // | |
40 | // NB: we use a counter-intuitive "disabled" flag instead of "enabled" one | |
41 | // because the default, for 0-initialized struct, should be to enable | |
42 | // logging | |
43 | bool loggingDisabled; | |
acad886c VZ |
44 | }; |
45 | ||
46 | // currently this is defined in src/common/log.cpp | |
47 | extern wxTLS_TYPE(wxThreadSpecificInfo) wxThreadInfoVar; | |
48 | #define wxThreadInfo wxTLS_VALUE(wxThreadInfoVar) | |
49 | ||
50 | #endif // wxUSE_THREADS | |
51 | ||
52 | #endif // _WX_PRIVATE_THREADINFO_H_ | |
53 |