[Cppunit-cvs] cppunit2/src/cpput testinfo.cpp,1.9,1.10
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2005-03-06 18:50:09
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14341/src/cpput Modified Files: testinfo.cpp Log Message: * moved cpput/thread.h to cpptl/thread.h * simplified thread-local storage access. Index: testinfo.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testinfo.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** testinfo.cpp 1 Mar 2005 19:36:51 -0000 1.9 --- testinfo.cpp 6 Mar 2005 18:49:59 -0000 1.10 *************** *** 1,4 **** #include <cpput/testinfo.h> ! #include <cpput/thread.h> namespace { --- 1,4 ---- #include <cpput/testinfo.h> ! #include <cpptl/thread.h> namespace { *************** *** 111,136 **** namespace TestInfo { ! // static TestInfoDataPtr staticData( new TestInfoData() ); ! ThreadLocalStorage<TestInfoDataPtr> staticData; ! ! static TestInfoDataPtr dataPtr() ! { ! const TestInfoDataPtr &data = staticData.get(); ! if ( !data ) ! { ! staticData.set( TestInfoDataPtr( new TestInfoData() ) ); ! return staticData.get(); ! } ! return data; ! } static TestInfoData &data() { ! return *dataPtr(); ! } ! ! static void setData( const TestInfoDataPtr &data ) ! { ! staticData = data; } --- 111,122 ---- namespace TestInfo { ! CppTL::ThreadLocalStorage<TestInfoDataPtr> staticData; static TestInfoData &data() { ! TestInfoDataPtr &data = staticData.get(); ! if ( !data ) ! data.reset( new TestInfoData() ); ! return *data; } *************** *** 259,264 **** TestInfoDataPtr saveAndResetContext() { ! TestInfoDataPtr oldData = dataPtr(); ! setData( TestInfoDataPtr( new TestInfoData() ) ); return oldData; } --- 245,250 ---- TestInfoDataPtr saveAndResetContext() { ! TestInfoDataPtr oldData = staticData.get(); ! staticData.get().reset( new TestInfoData() ); return oldData; } *************** *** 266,270 **** void restoreContext( const TestInfoDataPtr &oldContext ) { ! setData( oldContext ); } --- 252,256 ---- void restoreContext( const TestInfoDataPtr &oldContext ) { ! staticData = oldContext; } |