Make storing non-trivial data in wxThreadSpecificInfo possible.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74832 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2013-09-18 16:03:14 +00:00
parent 632c86a3e6
commit 92c0fc34c1
15 changed files with 177 additions and 18 deletions

View File

@ -804,6 +804,7 @@ ALL_BASE_SOURCES = \
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 \
@ -1000,6 +1001,7 @@ MONODLL_OBJECTS = \
monodll_tarstrm.o \
monodll_textbuf.o \
monodll_textfile.o \
monodll_threadinfo.o \
monodll_common_time.o \
monodll_timercmn.o \
monodll_timerimpl.o \
@ -1137,6 +1139,7 @@ MONOLIB_OBJECTS = \
monolib_tarstrm.o \
monolib_textbuf.o \
monolib_textfile.o \
monolib_threadinfo.o \
monolib_common_time.o \
monolib_timercmn.o \
monolib_timerimpl.o \
@ -1266,6 +1269,7 @@ BASEDLL_OBJECTS = \
basedll_tarstrm.o \
basedll_textbuf.o \
basedll_textfile.o \
basedll_threadinfo.o \
basedll_common_time.o \
basedll_timercmn.o \
basedll_timerimpl.o \
@ -1378,6 +1382,7 @@ BASELIB_OBJECTS = \
baselib_tarstrm.o \
baselib_textbuf.o \
baselib_textfile.o \
baselib_threadinfo.o \
baselib_common_time.o \
baselib_timercmn.o \
baselib_timerimpl.o \
@ -17063,6 +17068,9 @@ monodll_textbuf.o: $(srcdir)/src/common/textbuf.cpp $(MONODLL_ODEP)
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
@ -22931,6 +22939,9 @@ monolib_textbuf.o: $(srcdir)/src/common/textbuf.cpp $(MONOLIB_ODEP)
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
@ -28799,6 +28810,9 @@ basedll_textbuf.o: $(srcdir)/src/common/textbuf.cpp $(BASEDLL_ODEP)
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
@ -29312,6 +29326,9 @@ baselib_textbuf.o: $(srcdir)/src/common/textbuf.cpp $(BASELIB_ODEP)
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

View File

@ -358,6 +358,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
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

View File

@ -409,6 +409,7 @@ MONODLL_OBJECTS = \
$(OBJS)\monodll_tarstrm.obj \
$(OBJS)\monodll_textbuf.obj \
$(OBJS)\monodll_textfile.obj \
$(OBJS)\monodll_threadinfo.obj \
$(OBJS)\monodll_time.obj \
$(OBJS)\monodll_timercmn.obj \
$(OBJS)\monodll_timerimpl.obj \
@ -559,6 +560,7 @@ MONOLIB_OBJECTS = \
$(OBJS)\monolib_tarstrm.obj \
$(OBJS)\monolib_textbuf.obj \
$(OBJS)\monolib_textfile.obj \
$(OBJS)\monolib_threadinfo.obj \
$(OBJS)\monolib_time.obj \
$(OBJS)\monolib_timercmn.obj \
$(OBJS)\monolib_timerimpl.obj \
@ -706,6 +708,7 @@ BASEDLL_OBJECTS = \
$(OBJS)\basedll_tarstrm.obj \
$(OBJS)\basedll_textbuf.obj \
$(OBJS)\basedll_textfile.obj \
$(OBJS)\basedll_threadinfo.obj \
$(OBJS)\basedll_time.obj \
$(OBJS)\basedll_timercmn.obj \
$(OBJS)\basedll_timerimpl.obj \
@ -837,6 +840,7 @@ BASELIB_OBJECTS = \
$(OBJS)\baselib_tarstrm.obj \
$(OBJS)\baselib_textbuf.obj \
$(OBJS)\baselib_textfile.obj \
$(OBJS)\baselib_threadinfo.obj \
$(OBJS)\baselib_time.obj \
$(OBJS)\baselib_timercmn.obj \
$(OBJS)\baselib_timerimpl.obj \
@ -6431,6 +6435,9 @@ $(OBJS)\monodll_textbuf.obj: ..\..\src\common\textbuf.cpp
$(OBJS)\monodll_textfile.obj: ..\..\src\common\textfile.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\textfile.cpp
$(OBJS)\monodll_threadinfo.obj: ..\..\src\common\threadinfo.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\threadinfo.cpp
$(OBJS)\monodll_time.obj: ..\..\src\common\time.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\time.cpp
@ -8896,6 +8903,9 @@ $(OBJS)\monolib_textbuf.obj: ..\..\src\common\textbuf.cpp
$(OBJS)\monolib_textfile.obj: ..\..\src\common\textfile.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\textfile.cpp
$(OBJS)\monolib_threadinfo.obj: ..\..\src\common\threadinfo.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\threadinfo.cpp
$(OBJS)\monolib_time.obj: ..\..\src\common\time.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\time.cpp
@ -11361,6 +11371,9 @@ $(OBJS)\basedll_textbuf.obj: ..\..\src\common\textbuf.cpp
$(OBJS)\basedll_textfile.obj: ..\..\src\common\textfile.cpp
$(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\textfile.cpp
$(OBJS)\basedll_threadinfo.obj: ..\..\src\common\threadinfo.cpp
$(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\threadinfo.cpp
$(OBJS)\basedll_time.obj: ..\..\src\common\time.cpp
$(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\time.cpp
@ -11700,6 +11713,9 @@ $(OBJS)\baselib_textbuf.obj: ..\..\src\common\textbuf.cpp
$(OBJS)\baselib_textfile.obj: ..\..\src\common\textfile.cpp
$(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) ..\..\src\common\textfile.cpp
$(OBJS)\baselib_threadinfo.obj: ..\..\src\common\threadinfo.cpp
$(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) ..\..\src\common\threadinfo.cpp
$(OBJS)\baselib_time.obj: ..\..\src\common\time.cpp
$(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) ..\..\src\common\time.cpp

View File

@ -395,6 +395,7 @@ MONODLL_OBJECTS = \
$(OBJS)\monodll_tarstrm.o \
$(OBJS)\monodll_textbuf.o \
$(OBJS)\monodll_textfile.o \
$(OBJS)\monodll_threadinfo.o \
$(OBJS)\monodll_time.o \
$(OBJS)\monodll_timercmn.o \
$(OBJS)\monodll_timerimpl.o \
@ -546,6 +547,7 @@ MONOLIB_OBJECTS = \
$(OBJS)\monolib_tarstrm.o \
$(OBJS)\monolib_textbuf.o \
$(OBJS)\monolib_textfile.o \
$(OBJS)\monolib_threadinfo.o \
$(OBJS)\monolib_time.o \
$(OBJS)\monolib_timercmn.o \
$(OBJS)\monolib_timerimpl.o \
@ -694,6 +696,7 @@ BASEDLL_OBJECTS = \
$(OBJS)\basedll_tarstrm.o \
$(OBJS)\basedll_textbuf.o \
$(OBJS)\basedll_textfile.o \
$(OBJS)\basedll_threadinfo.o \
$(OBJS)\basedll_time.o \
$(OBJS)\basedll_timercmn.o \
$(OBJS)\basedll_timerimpl.o \
@ -826,6 +829,7 @@ BASELIB_OBJECTS = \
$(OBJS)\baselib_tarstrm.o \
$(OBJS)\baselib_textbuf.o \
$(OBJS)\baselib_textfile.o \
$(OBJS)\baselib_threadinfo.o \
$(OBJS)\baselib_time.o \
$(OBJS)\baselib_timercmn.o \
$(OBJS)\baselib_timerimpl.o \
@ -6601,6 +6605,9 @@ $(OBJS)\monodll_textbuf.o: ../../src/common/textbuf.cpp
$(OBJS)\monodll_textfile.o: ../../src/common/textfile.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_threadinfo.o: ../../src/common/threadinfo.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_time.o: ../../src/common/time.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
@ -9066,6 +9073,9 @@ $(OBJS)\monolib_textbuf.o: ../../src/common/textbuf.cpp
$(OBJS)\monolib_textfile.o: ../../src/common/textfile.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monolib_threadinfo.o: ../../src/common/threadinfo.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monolib_time.o: ../../src/common/time.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
@ -11531,6 +11541,9 @@ $(OBJS)\basedll_textbuf.o: ../../src/common/textbuf.cpp
$(OBJS)\basedll_textfile.o: ../../src/common/textfile.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\basedll_threadinfo.o: ../../src/common/threadinfo.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\basedll_time.o: ../../src/common/time.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
@ -11870,6 +11883,9 @@ $(OBJS)\baselib_textbuf.o: ../../src/common/textbuf.cpp
$(OBJS)\baselib_textfile.o: ../../src/common/textfile.cpp
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\baselib_threadinfo.o: ../../src/common/threadinfo.cpp
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\baselib_time.o: ../../src/common/time.cpp
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<

View File

@ -426,6 +426,7 @@ MONODLL_OBJECTS = \
$(OBJS)\monodll_tarstrm.obj \
$(OBJS)\monodll_textbuf.obj \
$(OBJS)\monodll_textfile.obj \
$(OBJS)\monodll_threadinfo.obj \
$(OBJS)\monodll_time.obj \
$(OBJS)\monodll_timercmn.obj \
$(OBJS)\monodll_timerimpl.obj \
@ -586,6 +587,7 @@ MONOLIB_OBJECTS = \
$(OBJS)\monolib_tarstrm.obj \
$(OBJS)\monolib_textbuf.obj \
$(OBJS)\monolib_textfile.obj \
$(OBJS)\monolib_threadinfo.obj \
$(OBJS)\monolib_time.obj \
$(OBJS)\monolib_timercmn.obj \
$(OBJS)\monolib_timerimpl.obj \
@ -740,6 +742,7 @@ BASEDLL_OBJECTS = \
$(OBJS)\basedll_tarstrm.obj \
$(OBJS)\basedll_textbuf.obj \
$(OBJS)\basedll_textfile.obj \
$(OBJS)\basedll_threadinfo.obj \
$(OBJS)\basedll_time.obj \
$(OBJS)\basedll_timercmn.obj \
$(OBJS)\basedll_timerimpl.obj \
@ -881,6 +884,7 @@ BASELIB_OBJECTS = \
$(OBJS)\baselib_tarstrm.obj \
$(OBJS)\baselib_textbuf.obj \
$(OBJS)\baselib_textfile.obj \
$(OBJS)\baselib_threadinfo.obj \
$(OBJS)\baselib_time.obj \
$(OBJS)\baselib_timercmn.obj \
$(OBJS)\baselib_timerimpl.obj \
@ -7116,6 +7120,9 @@ $(OBJS)\monodll_textbuf.obj: ..\..\src\common\textbuf.cpp
$(OBJS)\monodll_textfile.obj: ..\..\src\common\textfile.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\textfile.cpp
$(OBJS)\monodll_threadinfo.obj: ..\..\src\common\threadinfo.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\threadinfo.cpp
$(OBJS)\monodll_time.obj: ..\..\src\common\time.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\time.cpp
@ -9581,6 +9588,9 @@ $(OBJS)\monolib_textbuf.obj: ..\..\src\common\textbuf.cpp
$(OBJS)\monolib_textfile.obj: ..\..\src\common\textfile.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\textfile.cpp
$(OBJS)\monolib_threadinfo.obj: ..\..\src\common\threadinfo.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\threadinfo.cpp
$(OBJS)\monolib_time.obj: ..\..\src\common\time.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\time.cpp
@ -12046,6 +12056,9 @@ $(OBJS)\basedll_textbuf.obj: ..\..\src\common\textbuf.cpp
$(OBJS)\basedll_textfile.obj: ..\..\src\common\textfile.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\textfile.cpp
$(OBJS)\basedll_threadinfo.obj: ..\..\src\common\threadinfo.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\threadinfo.cpp
$(OBJS)\basedll_time.obj: ..\..\src\common\time.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\time.cpp
@ -12385,6 +12398,9 @@ $(OBJS)\baselib_textbuf.obj: ..\..\src\common\textbuf.cpp
$(OBJS)\baselib_textfile.obj: ..\..\src\common\textfile.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\textfile.cpp
$(OBJS)\baselib_threadinfo.obj: ..\..\src\common\threadinfo.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\threadinfo.cpp
$(OBJS)\baselib_time.obj: ..\..\src\common\time.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\time.cpp

View File

@ -4024,6 +4024,7 @@ MONODLL_OBJECTS = &
$(OBJS)\monodll_tarstrm.obj &
$(OBJS)\monodll_textbuf.obj &
$(OBJS)\monodll_textfile.obj &
$(OBJS)\monodll_threadinfo.obj &
$(OBJS)\monodll_time.obj &
$(OBJS)\monodll_timercmn.obj &
$(OBJS)\monodll_timerimpl.obj &
@ -4174,6 +4175,7 @@ MONOLIB_OBJECTS = &
$(OBJS)\monolib_tarstrm.obj &
$(OBJS)\monolib_textbuf.obj &
$(OBJS)\monolib_textfile.obj &
$(OBJS)\monolib_threadinfo.obj &
$(OBJS)\monolib_time.obj &
$(OBJS)\monolib_timercmn.obj &
$(OBJS)\monolib_timerimpl.obj &
@ -4320,6 +4322,7 @@ BASEDLL_OBJECTS = &
$(OBJS)\basedll_tarstrm.obj &
$(OBJS)\basedll_textbuf.obj &
$(OBJS)\basedll_textfile.obj &
$(OBJS)\basedll_threadinfo.obj &
$(OBJS)\basedll_time.obj &
$(OBJS)\basedll_timercmn.obj &
$(OBJS)\basedll_timerimpl.obj &
@ -4451,6 +4454,7 @@ BASELIB_OBJECTS = &
$(OBJS)\baselib_tarstrm.obj &
$(OBJS)\baselib_textbuf.obj &
$(OBJS)\baselib_textfile.obj &
$(OBJS)\baselib_threadinfo.obj &
$(OBJS)\baselib_time.obj &
$(OBJS)\baselib_timercmn.obj &
$(OBJS)\baselib_timerimpl.obj &
@ -6874,6 +6878,9 @@ $(OBJS)\monodll_textbuf.obj : .AUTODEPEND ..\..\src\common\textbuf.cpp
$(OBJS)\monodll_textfile.obj : .AUTODEPEND ..\..\src\common\textfile.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
$(OBJS)\monodll_threadinfo.obj : .AUTODEPEND ..\..\src\common\threadinfo.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
$(OBJS)\monodll_time.obj : .AUTODEPEND ..\..\src\common\time.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
@ -9339,6 +9346,9 @@ $(OBJS)\monolib_textbuf.obj : .AUTODEPEND ..\..\src\common\textbuf.cpp
$(OBJS)\monolib_textfile.obj : .AUTODEPEND ..\..\src\common\textfile.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
$(OBJS)\monolib_threadinfo.obj : .AUTODEPEND ..\..\src\common\threadinfo.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
$(OBJS)\monolib_time.obj : .AUTODEPEND ..\..\src\common\time.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
@ -11804,6 +11814,9 @@ $(OBJS)\basedll_textbuf.obj : .AUTODEPEND ..\..\src\common\textbuf.cpp
$(OBJS)\basedll_textfile.obj : .AUTODEPEND ..\..\src\common\textfile.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<
$(OBJS)\basedll_threadinfo.obj : .AUTODEPEND ..\..\src\common\threadinfo.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<
$(OBJS)\basedll_time.obj : .AUTODEPEND ..\..\src\common\time.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<
@ -12143,6 +12156,9 @@ $(OBJS)\baselib_textbuf.obj : .AUTODEPEND ..\..\src\common\textbuf.cpp
$(OBJS)\baselib_textfile.obj : .AUTODEPEND ..\..\src\common\textfile.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<
$(OBJS)\baselib_threadinfo.obj : .AUTODEPEND ..\..\src\common\threadinfo.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<
$(OBJS)\baselib_time.obj : .AUTODEPEND ..\..\src\common\time.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<

View File

@ -427,6 +427,10 @@ SOURCE=..\..\src\common\textfile.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\common\threadinfo.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\common\time.cpp
# End Source File
# Begin Source File

View File

@ -328,6 +328,7 @@
<ClCompile Include="..\..\src\common\tarstrm.cpp" />
<ClCompile Include="..\..\src\common\textbuf.cpp" />
<ClCompile Include="..\..\src\common\textfile.cpp" />
<ClCompile Include="..\..\src\common\threadinfo.cpp" />
<ClCompile Include="..\..\src\common\time.cpp" />
<ClCompile Include="..\..\src\common\timercmn.cpp" />
<ClCompile Include="..\..\src\common\timerimpl.cpp" />

View File

@ -366,6 +366,9 @@
<ClCompile Include="..\..\src\generic\fswatcherg.cpp">
<Filter>Generic Sources</Filter>
</ClCompile>
<ClCompile Include="..\..\src\common\threadinfo.cpp">
<Filter>Common Sources</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\src\msw\version.rc">

View File

@ -537,6 +537,9 @@
<File
RelativePath="..\..\src\common\textfile.cpp">
</File>
<File
RelativePath="..\..\src\common\threadinfo.cpp">
</File>
<File
RelativePath="..\..\src\common\time.cpp">
</File>

View File

@ -732,6 +732,10 @@
RelativePath="..\..\src\common\textfile.cpp"
>
</File>
<File
RelativePath="..\..\src\common\threadinfo.cpp"
>
</File>
<File
RelativePath="..\..\src\common\time.cpp"
>

View File

@ -730,6 +730,10 @@
RelativePath="..\..\src\common\textfile.cpp"
>
</File>
<File
RelativePath="..\..\src\common\threadinfo.cpp"
>
</File>
<File
RelativePath="..\..\src\common\time.cpp"
>

View File

@ -10,9 +10,7 @@
#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;
@ -20,15 +18,15 @@ 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)
@ -41,13 +39,12 @@ struct wxThreadSpecificInfo
// because the default, for 0-initialized struct, should be to enable
// logging
bool loggingDisabled;
private:
wxThreadSpecificInfo() : logger(NULL), loggingDisabled(false) {}
};
// currently this is defined in src/common/log.cpp
extern wxTLS_TYPE(wxThreadSpecificInfo) wxThreadInfoVar;
#define wxThreadInfo wxTLS_VALUE(wxThreadInfoVar)
#endif // wxUSE_THREADS
#define wxThreadInfo wxThreadSpecificInfo::Get()
#endif // _WX_PRIVATE_THREADINFO_H_

View File

@ -87,8 +87,6 @@ const char *wxLOG_COMPONENT = "";
#if wxUSE_THREADS
wxTLS_TYPE(wxThreadSpecificInfo) wxThreadInfoVar;
namespace
{

63
src/common/threadinfo.cpp Normal file
View File

@ -0,0 +1,63 @@
///////////////////////////////////////////////////////////////////////////////
// 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