Add support for thread-specific log targets.
[wxWidgets.git] / include / wx / private / threadinfo.h
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 {
33 wxLog *logger;
34 };
35
36 // currently this is defined in src/common/log.cpp
37 extern wxTLS_TYPE(wxThreadSpecificInfo) wxThreadInfoVar;
38 #define wxThreadInfo wxTLS_VALUE(wxThreadInfoVar)
39
40 #endif // wxUSE_THREADS
41
42 #endif // _WX_PRIVATE_THREADINFO_H_
43