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