Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49978 - trunk/libs/thread/example
From: anthony_at_[hidden]
Date: 2008-11-28 06:01:21


Author: anthonyw
Date: 2008-11-28 06:01:21 EST (Fri, 28 Nov 2008)
New Revision: 49978
URL: http://svn.boost.org/trac/boost/changeset/49978

Log:
Undo commit from r49977 which added extraneous throw to thread example
Text files modified:
   trunk/libs/thread/example/condition.cpp | 9 ++++++++-
   trunk/libs/thread/example/tennis.cpp | 2 +-
   trunk/libs/thread/example/thread.cpp | 1 -
   3 files changed, 9 insertions(+), 3 deletions(-)

Modified: trunk/libs/thread/example/condition.cpp
==============================================================================
--- trunk/libs/thread/example/condition.cpp (original)
+++ trunk/libs/thread/example/condition.cpp 2008-11-28 06:01:21 EST (Fri, 28 Nov 2008)
@@ -50,8 +50,9 @@
 
 void sender() {
     int n = 0;
- while (n < 100) {
+ while (n < 1000000) {
         buf.send(n);
+ if(!(n%10000))
         {
             boost::mutex::scoped_lock io_lock(io_mutex);
             std::cout << "sent: " << n << std::endl;
@@ -65,18 +66,24 @@
     int n;
     do {
         n = buf.receive();
+ if(!(n%10000))
         {
             boost::mutex::scoped_lock io_lock(io_mutex);
             std::cout << "received: " << n << std::endl;
         }
     } while (n != -1); // -1 indicates end of buffer
+ buf.send(-1);
 }
 
 int main(int, char*[])
 {
     boost::thread thrd1(&sender);
     boost::thread thrd2(&receiver);
+ boost::thread thrd3(&receiver);
+ boost::thread thrd4(&receiver);
     thrd1.join();
     thrd2.join();
+ thrd3.join();
+ thrd4.join();
     return 0;
 }

Modified: trunk/libs/thread/example/tennis.cpp
==============================================================================
--- trunk/libs/thread/example/tennis.cpp (original)
+++ trunk/libs/thread/example/tennis.cpp 2008-11-28 06:01:21 EST (Fri, 28 Nov 2008)
@@ -112,7 +112,7 @@
         std::cout << "---Noise ON..." << std::endl;
     }
 
- for (int i = 0; i < 1000000; ++i)
+ for (int i = 0; i < 1000000000; ++i)
         cond.notify_all();
 
     {

Modified: trunk/libs/thread/example/thread.cpp
==============================================================================
--- trunk/libs/thread/example/thread.cpp (original)
+++ trunk/libs/thread/example/thread.cpp 2008-11-28 06:01:21 EST (Fri, 28 Nov 2008)
@@ -20,7 +20,6 @@
         boost::thread::sleep(xt);
 
         std::cout << "alarm sounded..." << std::endl;
- throw "foo";
     }
 
     int m_secs;


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