src/common/tarstrm.cpp \
src/common/textbuf.cpp \
src/common/textfile.cpp \
+ src/common/threadinfo.cpp \
src/common/time.cpp \
src/common/timercmn.cpp \
src/common/timerimpl.cpp \
monodll_tarstrm.o \
monodll_textbuf.o \
monodll_textfile.o \
+ monodll_threadinfo.o \
monodll_common_time.o \
monodll_timercmn.o \
monodll_timerimpl.o \
monolib_tarstrm.o \
monolib_textbuf.o \
monolib_textfile.o \
+ monolib_threadinfo.o \
monolib_common_time.o \
monolib_timercmn.o \
monolib_timerimpl.o \
basedll_tarstrm.o \
basedll_textbuf.o \
basedll_textfile.o \
+ basedll_threadinfo.o \
basedll_common_time.o \
basedll_timercmn.o \
basedll_timerimpl.o \
baselib_tarstrm.o \
baselib_textbuf.o \
baselib_textfile.o \
+ baselib_threadinfo.o \
baselib_common_time.o \
baselib_timercmn.o \
baselib_timerimpl.o \
monodll_textfile.o: $(srcdir)/src/common/textfile.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/textfile.cpp
+monodll_threadinfo.o: $(srcdir)/src/common/threadinfo.cpp $(MONODLL_ODEP)
+ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/threadinfo.cpp
+
monodll_common_time.o: $(srcdir)/src/common/time.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/time.cpp
monolib_textfile.o: $(srcdir)/src/common/textfile.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/textfile.cpp
+monolib_threadinfo.o: $(srcdir)/src/common/threadinfo.cpp $(MONOLIB_ODEP)
+ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/threadinfo.cpp
+
monolib_common_time.o: $(srcdir)/src/common/time.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/time.cpp
basedll_textfile.o: $(srcdir)/src/common/textfile.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/textfile.cpp
+basedll_threadinfo.o: $(srcdir)/src/common/threadinfo.cpp $(BASEDLL_ODEP)
+ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/threadinfo.cpp
+
basedll_common_time.o: $(srcdir)/src/common/time.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/time.cpp
baselib_textfile.o: $(srcdir)/src/common/textfile.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/textfile.cpp
+baselib_threadinfo.o: $(srcdir)/src/common/threadinfo.cpp $(BASELIB_ODEP)
+ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/threadinfo.cpp
+
baselib_common_time.o: $(srcdir)/src/common/time.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/time.cpp
src/common/tarstrm.cpp
src/common/textbuf.cpp
src/common/textfile.cpp
+ src/common/threadinfo.cpp
src/common/time.cpp
src/common/timercmn.cpp
src/common/timerimpl.cpp
$(OBJS)\monodll_tarstrm.obj \\r
$(OBJS)\monodll_textbuf.obj \\r
$(OBJS)\monodll_textfile.obj \\r
+ $(OBJS)\monodll_threadinfo.obj \\r
$(OBJS)\monodll_time.obj \\r
$(OBJS)\monodll_timercmn.obj \\r
$(OBJS)\monodll_timerimpl.obj \\r
$(OBJS)\monolib_tarstrm.obj \\r
$(OBJS)\monolib_textbuf.obj \\r
$(OBJS)\monolib_textfile.obj \\r
+ $(OBJS)\monolib_threadinfo.obj \\r
$(OBJS)\monolib_time.obj \\r
$(OBJS)\monolib_timercmn.obj \\r
$(OBJS)\monolib_timerimpl.obj \\r
$(OBJS)\basedll_tarstrm.obj \\r
$(OBJS)\basedll_textbuf.obj \\r
$(OBJS)\basedll_textfile.obj \\r
+ $(OBJS)\basedll_threadinfo.obj \\r
$(OBJS)\basedll_time.obj \\r
$(OBJS)\basedll_timercmn.obj \\r
$(OBJS)\basedll_timerimpl.obj \\r
$(OBJS)\baselib_tarstrm.obj \\r
$(OBJS)\baselib_textbuf.obj \\r
$(OBJS)\baselib_textfile.obj \\r
+ $(OBJS)\baselib_threadinfo.obj \\r
$(OBJS)\baselib_time.obj \\r
$(OBJS)\baselib_timercmn.obj \\r
$(OBJS)\baselib_timerimpl.obj \\r
$(OBJS)\monodll_textfile.obj: ..\..\src\common\textfile.cpp\r
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\textfile.cpp\r
\r
+$(OBJS)\monodll_threadinfo.obj: ..\..\src\common\threadinfo.cpp\r
+ $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\threadinfo.cpp\r
+\r
$(OBJS)\monodll_time.obj: ..\..\src\common\time.cpp\r
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\time.cpp\r
\r
$(OBJS)\monolib_textfile.obj: ..\..\src\common\textfile.cpp\r
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\textfile.cpp\r
\r
+$(OBJS)\monolib_threadinfo.obj: ..\..\src\common\threadinfo.cpp\r
+ $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\threadinfo.cpp\r
+\r
$(OBJS)\monolib_time.obj: ..\..\src\common\time.cpp\r
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\time.cpp\r
\r
$(OBJS)\basedll_textfile.obj: ..\..\src\common\textfile.cpp\r
$(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\textfile.cpp\r
\r
+$(OBJS)\basedll_threadinfo.obj: ..\..\src\common\threadinfo.cpp\r
+ $(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\threadinfo.cpp\r
+\r
$(OBJS)\basedll_time.obj: ..\..\src\common\time.cpp\r
$(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\time.cpp\r
\r
$(OBJS)\baselib_textfile.obj: ..\..\src\common\textfile.cpp\r
$(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) ..\..\src\common\textfile.cpp\r
\r
+$(OBJS)\baselib_threadinfo.obj: ..\..\src\common\threadinfo.cpp\r
+ $(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) ..\..\src\common\threadinfo.cpp\r
+\r
$(OBJS)\baselib_time.obj: ..\..\src\common\time.cpp\r
$(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) ..\..\src\common\time.cpp\r
\r
$(OBJS)\monodll_tarstrm.o \\r
$(OBJS)\monodll_textbuf.o \\r
$(OBJS)\monodll_textfile.o \\r
+ $(OBJS)\monodll_threadinfo.o \\r
$(OBJS)\monodll_time.o \\r
$(OBJS)\monodll_timercmn.o \\r
$(OBJS)\monodll_timerimpl.o \\r
$(OBJS)\monolib_tarstrm.o \\r
$(OBJS)\monolib_textbuf.o \\r
$(OBJS)\monolib_textfile.o \\r
+ $(OBJS)\monolib_threadinfo.o \\r
$(OBJS)\monolib_time.o \\r
$(OBJS)\monolib_timercmn.o \\r
$(OBJS)\monolib_timerimpl.o \\r
$(OBJS)\basedll_tarstrm.o \\r
$(OBJS)\basedll_textbuf.o \\r
$(OBJS)\basedll_textfile.o \\r
+ $(OBJS)\basedll_threadinfo.o \\r
$(OBJS)\basedll_time.o \\r
$(OBJS)\basedll_timercmn.o \\r
$(OBJS)\basedll_timerimpl.o \\r
$(OBJS)\baselib_tarstrm.o \\r
$(OBJS)\baselib_textbuf.o \\r
$(OBJS)\baselib_textfile.o \\r
+ $(OBJS)\baselib_threadinfo.o \\r
$(OBJS)\baselib_time.o \\r
$(OBJS)\baselib_timercmn.o \\r
$(OBJS)\baselib_timerimpl.o \\r
$(OBJS)\monodll_textfile.o: ../../src/common/textfile.cpp\r
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<\r
\r
+$(OBJS)\monodll_threadinfo.o: ../../src/common/threadinfo.cpp\r
+ $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<\r
+\r
$(OBJS)\monodll_time.o: ../../src/common/time.cpp\r
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<\r
\r
$(OBJS)\monolib_textfile.o: ../../src/common/textfile.cpp\r
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<\r
\r
+$(OBJS)\monolib_threadinfo.o: ../../src/common/threadinfo.cpp\r
+ $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<\r
+\r
$(OBJS)\monolib_time.o: ../../src/common/time.cpp\r
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<\r
\r
$(OBJS)\basedll_textfile.o: ../../src/common/textfile.cpp\r
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<\r
\r
+$(OBJS)\basedll_threadinfo.o: ../../src/common/threadinfo.cpp\r
+ $(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<\r
+\r
$(OBJS)\basedll_time.o: ../../src/common/time.cpp\r
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<\r
\r
$(OBJS)\baselib_textfile.o: ../../src/common/textfile.cpp\r
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<\r
\r
+$(OBJS)\baselib_threadinfo.o: ../../src/common/threadinfo.cpp\r
+ $(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<\r
+\r
$(OBJS)\baselib_time.o: ../../src/common/time.cpp\r
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<\r
\r
$(OBJS)\monodll_tarstrm.obj \\r
$(OBJS)\monodll_textbuf.obj \\r
$(OBJS)\monodll_textfile.obj \\r
+ $(OBJS)\monodll_threadinfo.obj \\r
$(OBJS)\monodll_time.obj \\r
$(OBJS)\monodll_timercmn.obj \\r
$(OBJS)\monodll_timerimpl.obj \\r
$(OBJS)\monolib_tarstrm.obj \\r
$(OBJS)\monolib_textbuf.obj \\r
$(OBJS)\monolib_textfile.obj \\r
+ $(OBJS)\monolib_threadinfo.obj \\r
$(OBJS)\monolib_time.obj \\r
$(OBJS)\monolib_timercmn.obj \\r
$(OBJS)\monolib_timerimpl.obj \\r
$(OBJS)\basedll_tarstrm.obj \\r
$(OBJS)\basedll_textbuf.obj \\r
$(OBJS)\basedll_textfile.obj \\r
+ $(OBJS)\basedll_threadinfo.obj \\r
$(OBJS)\basedll_time.obj \\r
$(OBJS)\basedll_timercmn.obj \\r
$(OBJS)\basedll_timerimpl.obj \\r
$(OBJS)\baselib_tarstrm.obj \\r
$(OBJS)\baselib_textbuf.obj \\r
$(OBJS)\baselib_textfile.obj \\r
+ $(OBJS)\baselib_threadinfo.obj \\r
$(OBJS)\baselib_time.obj \\r
$(OBJS)\baselib_timercmn.obj \\r
$(OBJS)\baselib_timerimpl.obj \\r
$(OBJS)\monodll_textfile.obj: ..\..\src\common\textfile.cpp\r
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\textfile.cpp\r
\r
+$(OBJS)\monodll_threadinfo.obj: ..\..\src\common\threadinfo.cpp\r
+ $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\threadinfo.cpp\r
+\r
$(OBJS)\monodll_time.obj: ..\..\src\common\time.cpp\r
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\time.cpp\r
\r
$(OBJS)\monolib_textfile.obj: ..\..\src\common\textfile.cpp\r
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\textfile.cpp\r
\r
+$(OBJS)\monolib_threadinfo.obj: ..\..\src\common\threadinfo.cpp\r
+ $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\threadinfo.cpp\r
+\r
$(OBJS)\monolib_time.obj: ..\..\src\common\time.cpp\r
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\time.cpp\r
\r
$(OBJS)\basedll_textfile.obj: ..\..\src\common\textfile.cpp\r
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\textfile.cpp\r
\r
+$(OBJS)\basedll_threadinfo.obj: ..\..\src\common\threadinfo.cpp\r
+ $(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\threadinfo.cpp\r
+\r
$(OBJS)\basedll_time.obj: ..\..\src\common\time.cpp\r
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\time.cpp\r
\r
$(OBJS)\baselib_textfile.obj: ..\..\src\common\textfile.cpp\r
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\textfile.cpp\r
\r
+$(OBJS)\baselib_threadinfo.obj: ..\..\src\common\threadinfo.cpp\r
+ $(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\threadinfo.cpp\r
+\r
$(OBJS)\baselib_time.obj: ..\..\src\common\time.cpp\r
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\time.cpp\r
\r
$(OBJS)\monodll_tarstrm.obj &\r
$(OBJS)\monodll_textbuf.obj &\r
$(OBJS)\monodll_textfile.obj &\r
+ $(OBJS)\monodll_threadinfo.obj &\r
$(OBJS)\monodll_time.obj &\r
$(OBJS)\monodll_timercmn.obj &\r
$(OBJS)\monodll_timerimpl.obj &\r
$(OBJS)\monolib_tarstrm.obj &\r
$(OBJS)\monolib_textbuf.obj &\r
$(OBJS)\monolib_textfile.obj &\r
+ $(OBJS)\monolib_threadinfo.obj &\r
$(OBJS)\monolib_time.obj &\r
$(OBJS)\monolib_timercmn.obj &\r
$(OBJS)\monolib_timerimpl.obj &\r
$(OBJS)\basedll_tarstrm.obj &\r
$(OBJS)\basedll_textbuf.obj &\r
$(OBJS)\basedll_textfile.obj &\r
+ $(OBJS)\basedll_threadinfo.obj &\r
$(OBJS)\basedll_time.obj &\r
$(OBJS)\basedll_timercmn.obj &\r
$(OBJS)\basedll_timerimpl.obj &\r
$(OBJS)\baselib_tarstrm.obj &\r
$(OBJS)\baselib_textbuf.obj &\r
$(OBJS)\baselib_textfile.obj &\r
+ $(OBJS)\baselib_threadinfo.obj &\r
$(OBJS)\baselib_time.obj &\r
$(OBJS)\baselib_timercmn.obj &\r
$(OBJS)\baselib_timerimpl.obj &\r
$(OBJS)\monodll_textfile.obj : .AUTODEPEND ..\..\src\common\textfile.cpp\r
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<\r
\r
+$(OBJS)\monodll_threadinfo.obj : .AUTODEPEND ..\..\src\common\threadinfo.cpp\r
+ $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<\r
+\r
$(OBJS)\monodll_time.obj : .AUTODEPEND ..\..\src\common\time.cpp\r
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<\r
\r
$(OBJS)\monolib_textfile.obj : .AUTODEPEND ..\..\src\common\textfile.cpp\r
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<\r
\r
+$(OBJS)\monolib_threadinfo.obj : .AUTODEPEND ..\..\src\common\threadinfo.cpp\r
+ $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<\r
+\r
$(OBJS)\monolib_time.obj : .AUTODEPEND ..\..\src\common\time.cpp\r
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<\r
\r
$(OBJS)\basedll_textfile.obj : .AUTODEPEND ..\..\src\common\textfile.cpp\r
$(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<\r
\r
+$(OBJS)\basedll_threadinfo.obj : .AUTODEPEND ..\..\src\common\threadinfo.cpp\r
+ $(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<\r
+\r
$(OBJS)\basedll_time.obj : .AUTODEPEND ..\..\src\common\time.cpp\r
$(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<\r
\r
$(OBJS)\baselib_textfile.obj : .AUTODEPEND ..\..\src\common\textfile.cpp\r
$(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<\r
\r
+$(OBJS)\baselib_threadinfo.obj : .AUTODEPEND ..\..\src\common\threadinfo.cpp\r
+ $(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<\r
+\r
$(OBJS)\baselib_time.obj : .AUTODEPEND ..\..\src\common\time.cpp\r
$(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<\r
\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=..\..\src\common\threadinfo.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=..\..\src\common\time.cpp\r
# End Source File\r
# Begin Source File\r
<ClCompile Include="..\..\src\common\tarstrm.cpp" />\r
<ClCompile Include="..\..\src\common\textbuf.cpp" />\r
<ClCompile Include="..\..\src\common\textfile.cpp" />\r
+ <ClCompile Include="..\..\src\common\threadinfo.cpp" />\r
<ClCompile Include="..\..\src\common\time.cpp" />\r
<ClCompile Include="..\..\src\common\timercmn.cpp" />\r
<ClCompile Include="..\..\src\common\timerimpl.cpp" />\r
<ClCompile Include="..\..\src\generic\fswatcherg.cpp">\r
<Filter>Generic Sources</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\..\src\common\threadinfo.cpp">\r
+ <Filter>Common Sources</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ResourceCompile Include="..\..\src\msw\version.rc">\r
<File\r
RelativePath="..\..\src\common\textfile.cpp">\r
</File>\r
+ <File\r
+ RelativePath="..\..\src\common\threadinfo.cpp">\r
+ </File>\r
<File\r
RelativePath="..\..\src\common\time.cpp">\r
</File>\r
RelativePath="..\..\src\common\textfile.cpp"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\src\common\threadinfo.cpp"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\src\common\time.cpp"\r
>\r
RelativePath="..\..\src\common\textfile.cpp"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\src\common\threadinfo.cpp"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\src\common\time.cpp"\r
>\r
#ifndef _WX_PRIVATE_THREADINFO_H_
#define _WX_PRIVATE_THREADINFO_H_
-#if wxUSE_THREADS
-
-#include "wx/tls.h"
+#include "wx/defs.h"
class WXDLLIMPEXP_FWD_BASE wxLog;
// wxThreadSpecificInfo: contains all thread-specific information used by wx
// ----------------------------------------------------------------------------
-// currently the only thread-specific information we use is the active wxLog
-// target but more could be added in the future (e.g. current wxLocale would be
-// a likely candidate) and we will group all of them in this struct to avoid
-// consuming more TLS slots than necessary as there is only a limited number of
-// them
-
-// NB: this must be a POD to be stored in TLS
-struct wxThreadSpecificInfo
+// Group all thread-specific information we use (e.g. the active wxLog target)
+// a in this class to avoid consuming more TLS slots than necessary as there is
+// only a limited number of them.
+class wxThreadSpecificInfo
{
+public:
+ // Return this thread's instance.
+ static wxThreadSpecificInfo& Get();
+
// the thread-specific logger or NULL if the thread is using the global one
// (this is not used for the main thread which always uses the global
// logger)
// because the default, for 0-initialized struct, should be to enable
// logging
bool loggingDisabled;
-};
-// currently this is defined in src/common/log.cpp
-extern wxTLS_TYPE(wxThreadSpecificInfo) wxThreadInfoVar;
-#define wxThreadInfo wxTLS_VALUE(wxThreadInfoVar)
+private:
+ wxThreadSpecificInfo() : logger(NULL), loggingDisabled(false) {}
+};
-#endif // wxUSE_THREADS
+#define wxThreadInfo wxThreadSpecificInfo::Get()
#endif // _WX_PRIVATE_THREADINFO_H_
#if wxUSE_THREADS
-wxTLS_TYPE(wxThreadSpecificInfo) wxThreadInfoVar;
-
namespace
{
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: src/common/threadinfo.cpp
+// Purpose: declaration of wxThreadSpecificInfo: thread-specific information
+// Author: Vaclav Slavik
+// Created: 2013-09-14
+// Copyright: (c) 2013 Vaclav Slavik <vslavik@fastmail.fm>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#if defined(__BORLANDC__)
+ #pragma hdrstop
+#endif
+
+#include "wx/private/threadinfo.h"
+
+#if wxUSE_THREADS
+
+#include "wx/tls.h"
+#include "wx/thread.h"
+#include "wx/sharedptr.h"
+#include "wx/vector.h"
+
+namespace
+{
+
+// All thread info objects are stored in a global list so that they are
+// freed when global objects are destroyed and no memory leaks are reported.
+//
+// TODO: This could be made more efficient by freeing g_thisThreadInfo when
+// wxThread terminates.
+wxCriticalSection g_csAllThreadInfos;
+wxVector< wxSharedPtr<wxThreadSpecificInfo> > g_allThreadInfos;
+
+// Pointer to currenct thread's instance
+wxTLS_TYPE(wxThreadSpecificInfo*) g_thisThreadInfo;
+
+} // anonymous namespace
+
+
+wxThreadSpecificInfo& wxThreadSpecificInfo::Get()
+{
+ if ( !wxTLS_VALUE(g_thisThreadInfo) )
+ {
+ wxTLS_VALUE(g_thisThreadInfo) = new wxThreadSpecificInfo;
+ wxCriticalSectionLocker lock(g_csAllThreadInfos);
+ g_allThreadInfos.push_back(
+ wxSharedPtr<wxThreadSpecificInfo>(wxTLS_VALUE(g_thisThreadInfo)));
+ }
+ return *wxTLS_VALUE(g_thisThreadInfo);
+}
+
+#else // !wxUSE_THREADS
+
+wxThreadSpecificInfo& wxThreadSpecificInfo::Get()
+{
+ static wxThreadSpecificInfo s_instance;
+ return s_instance;
+}
+
+#endif // wxUSE_THREADS/wxUSE_THREADS