Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78222 - trunk/libs/thread/example
From: vicente.botet_at_[hidden]
Date: 2012-04-27 18:24:18


Author: viboes
Date: 2012-04-27 18:24:17 EDT (Fri, 27 Apr 2012)
New Revision: 78222
URL: http://svn.boost.org/trac/boost/changeset/78222

Log:
Thread: Try to fix some errors with vacpp
Text files modified:
   trunk/libs/thread/example/shared_monitor.cpp | 11 +++++++++--
   trunk/libs/thread/example/shared_mutex.cpp | 7 +++++--
   2 files changed, 14 insertions(+), 4 deletions(-)

Modified: trunk/libs/thread/example/shared_monitor.cpp
==============================================================================
--- trunk/libs/thread/example/shared_monitor.cpp (original)
+++ trunk/libs/thread/example/shared_monitor.cpp 2012-04-27 18:24:17 EDT (Fri, 27 Apr 2012)
@@ -7,8 +7,9 @@
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/shared_mutex.hpp>
 #include <boost/thread/thread.hpp>
+#if defined BOOST_THREAD_DONT_USE_CHRONO
 #include <boost/chrono/chrono_io.hpp>
-
+#endif
 #include <cassert>
 #include <vector>
 
@@ -108,15 +109,19 @@
         la3.compute(a1, a2);
         a1 = la3;
         a2 = la3;
-// boost::this_thread::sleep_for(boost::chrono::seconds(1));
+#if defined BOOST_THREAD_DONT_USE_CHRONO
+ boost::this_thread::sleep_for(boost::chrono::seconds(1));
+#endif
     }
 }
 
 int main()
 {
+#if defined BOOST_THREAD_DONT_USE_CHRONO
     typedef boost::chrono::high_resolution_clock Clock;
     typedef boost::chrono::duration<double> sec;
     Clock::time_point t0 = Clock::now();
+#endif
     std::vector<boost::thread*> v;
     boost::thread thw(test_w);
     v.push_back(&thw);
@@ -130,7 +135,9 @@
     v.push_back(&thr3);
     for (std::size_t i = 0; i < v.size(); ++i)
         v[i]->join();
+#if defined BOOST_THREAD_DONT_USE_CHRONO
     Clock::time_point t1 = Clock::now();
     std::cout << sec(t1-t0) << '\n';
+#endif
     return 0;
 }

Modified: trunk/libs/thread/example/shared_mutex.cpp
==============================================================================
--- trunk/libs/thread/example/shared_mutex.cpp (original)
+++ trunk/libs/thread/example/shared_mutex.cpp 2012-04-27 18:24:17 EDT (Fri, 27 Apr 2012)
@@ -11,10 +11,10 @@
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/shared_mutex.hpp>
 #include <boost/thread/thread.hpp>
+
+#if defined BOOST_THREAD_USES_CHRONO
 #include <boost/chrono/chrono_io.hpp>
 
-#include <cassert>
-#include <vector>
 
 enum {reading, writing};
 int state = reading;
@@ -721,3 +721,6 @@
   return 0;
 }
 
+#else
+#error "This platform doesn't support Boost.Chrono"
+#endif


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