From: Václav Slavík Date: Wed, 18 Sep 2013 16:03:14 +0000 (+0000) Subject: Make storing non-trivial data in wxThreadSpecificInfo possible. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/92c0fc34c104c8d7c12d6a3b78ea232690fc23f4 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 --- diff --git a/Makefile.in b/Makefile.in index c1fccbb8c9..06eb0a97ab 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 3a032c6016..a297dfcf8c 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -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 diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index 339ad99519..e0c804e88c 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -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 diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index 62d4e21b21..850daa0770 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -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) $< diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index 0929c6fafe..e16b439743 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -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 diff --git a/build/msw/makefile.wat b/build/msw/makefile.wat index abbe7a9001..79603d5a90 100644 --- a/build/msw/makefile.wat +++ b/build/msw/makefile.wat @@ -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) $< diff --git a/build/msw/wx_base.dsp b/build/msw/wx_base.dsp index 9c726265d5..d41e54c1e6 100644 --- a/build/msw/wx_base.dsp +++ b/build/msw/wx_base.dsp @@ -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 diff --git a/build/msw/wx_vc10_base.vcxproj b/build/msw/wx_vc10_base.vcxproj index 0f402f5226..2f86237d43 100644 --- a/build/msw/wx_vc10_base.vcxproj +++ b/build/msw/wx_vc10_base.vcxproj @@ -328,6 +328,7 @@ + diff --git a/build/msw/wx_vc10_base.vcxproj.filters b/build/msw/wx_vc10_base.vcxproj.filters index a0ab314a64..7dbd959a59 100644 --- a/build/msw/wx_vc10_base.vcxproj.filters +++ b/build/msw/wx_vc10_base.vcxproj.filters @@ -366,6 +366,9 @@ Generic Sources + + Common Sources + diff --git a/build/msw/wx_vc7_base.vcproj b/build/msw/wx_vc7_base.vcproj index c2045ff117..d9fbe15892 100644 --- a/build/msw/wx_vc7_base.vcproj +++ b/build/msw/wx_vc7_base.vcproj @@ -537,6 +537,9 @@ + + diff --git a/build/msw/wx_vc8_base.vcproj b/build/msw/wx_vc8_base.vcproj index 94f7fbe526..2719275fc6 100644 --- a/build/msw/wx_vc8_base.vcproj +++ b/build/msw/wx_vc8_base.vcproj @@ -732,6 +732,10 @@ RelativePath="..\..\src\common\textfile.cpp" > + + diff --git a/build/msw/wx_vc9_base.vcproj b/build/msw/wx_vc9_base.vcproj index 0e5583f618..29a289a1a3 100644 --- a/build/msw/wx_vc9_base.vcproj +++ b/build/msw/wx_vc9_base.vcproj @@ -730,6 +730,10 @@ RelativePath="..\..\src\common\textfile.cpp" > + + diff --git a/include/wx/private/threadinfo.h b/include/wx/private/threadinfo.h index d6d75bb6ee..500af5dd9c 100644 --- a/include/wx/private/threadinfo.h +++ b/include/wx/private/threadinfo.h @@ -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; -}; -// 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_ diff --git a/src/common/log.cpp b/src/common/log.cpp index f74d88d9f8..3180f46743 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -87,8 +87,6 @@ const char *wxLOG_COMPONENT = ""; #if wxUSE_THREADS -wxTLS_TYPE(wxThreadSpecificInfo) wxThreadInfoVar; - namespace { diff --git a/src/common/threadinfo.cpp b/src/common/threadinfo.cpp new file mode 100644 index 0000000000..d72a8fb449 --- /dev/null +++ b/src/common/threadinfo.cpp @@ -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 +// 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 > 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(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