Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81646 - trunk/libs/thread/test
From: vicente.botet_at_[hidden]
Date: 2012-12-01 06:07:11


Author: viboes
Date: 2012-12-01 06:07:10 EST (Sat, 01 Dec 2012)
New Revision: 81646
URL: http://svn.boost.org/trac/boost/changeset/81646

Log:
Thread: Use BOOST_THREAD_LOG
Text files modified:
   trunk/libs/thread/test/test_7665.cpp | 17 +++++++++++++----
   1 files changed, 13 insertions(+), 4 deletions(-)

Modified: trunk/libs/thread/test/test_7665.cpp
==============================================================================
--- trunk/libs/thread/test/test_7665.cpp (original)
+++ trunk/libs/thread/test/test_7665.cpp 2012-12-01 06:07:10 EST (Sat, 01 Dec 2012)
@@ -4,27 +4,36 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #define BOOST_THREAD_VERSION 2
+#define BOOST_THREAD_USES_LOG
 
 #include <iostream>
 #include <boost/thread.hpp>
+#include <boost/thread/detail/log.hpp>
 
 void thread()
 {
- std::cout << "Sleeping for 10 seconds - change time\n";
+ BOOST_THREAD_LOG << "<thrd" << BOOST_THREAD_END_LOG;
+ try {
   boost::this_thread::sleep_for(boost::chrono::seconds(30));
- std::cout << "Ended\n";
+ } catch (...)
+ {
+ BOOST_THREAD_LOG << "thrd exception" << BOOST_THREAD_END_LOG;
+ throw;
+ }
   //while (1) ; // Never quit
+ BOOST_THREAD_LOG << "thrd>" << BOOST_THREAD_END_LOG;
 }
 
 boost::thread example(thread);
 
 int main()
 {
- std::cout << "Main thread START\n";
+ BOOST_THREAD_LOG << "<main" << BOOST_THREAD_END_LOG;
   boost::this_thread::sleep_for(boost::chrono::seconds(30));
- std::cout << "Main thread END\n";
+ BOOST_THREAD_LOG << "main" << BOOST_THREAD_END_LOG;
   //while (1) ; // Never quit
   example.join();
+ BOOST_THREAD_LOG << "main>" << BOOST_THREAD_END_LOG;
   return 0;
 }
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk