Boost logo

Boost-Commit :

From: doomster_at_[hidden]
Date: 2008-04-30 10:28:10


Author: eckhardt
Date: 2008-04-30 10:28:10 EDT (Wed, 30 Apr 2008)
New Revision: 44930
URL: http://svn.boost.org/trac/boost/changeset/44930

Log:
- Reformat using spaces for indention.

Text files modified:
   sandbox/compile-in-place/test-threads.cpp | 87 ++++++++++++++++++++-------------------
   1 files changed, 45 insertions(+), 42 deletions(-)

Modified: sandbox/compile-in-place/test-threads.cpp
==============================================================================
--- sandbox/compile-in-place/test-threads.cpp (original)
+++ sandbox/compile-in-place/test-threads.cpp 2008-04-30 10:28:10 EDT (Wed, 30 Apr 2008)
@@ -3,6 +3,9 @@
 Compile with
   $CXX -I /path/to/boost_X_YY_Z test-threads.cpp -l $THREADLIBS
 
+Notes:
+
+ - The thread libs are e.g. "pthread" for Linux.
 
 $Id$
 */
@@ -14,10 +17,10 @@
 
 void delay( unsigned sec)
 {
- boost::xtime xt;
- boost::xtime_get( &xt, boost::TIME_UTC);
- xt.sec += sec;
- boost::thread::sleep(xt);
+ boost::xtime xt;
+ boost::xtime_get( &xt, boost::TIME_UTC);
+ xt.sec += sec;
+ boost::thread::sleep(xt);
 }
 
 typedef boost::recursive_mutex mutex;
@@ -28,57 +31,57 @@
 
 void thread1()
 {
- std::cerr << "thread 1 entering\n";
+ std::cerr << "thread 1 entering\n";
 
- delay(2);
- {
- std::cerr << "thread 1 acquiring mutex...\n";
- scoped_lock lock(mtx);
- std::cerr << "thread 1 acquired mutex\n";
- delay(2);
- std::cerr << "thread 1 releasing mutex\n";
- }
- delay(2);
+ delay(2);
+ {
+ std::cerr << "thread 1 acquiring mutex...\n";
+ scoped_lock lock(mtx);
+ std::cerr << "thread 1 acquired mutex\n";
+ delay(2);
+ std::cerr << "thread 1 releasing mutex\n";
+ }
+ delay(2);
 
- std::cerr << "thread 1 leaving\n";
+ std::cerr << "thread 1 leaving\n";
 }
 
 void thread2()
 {
- std::cerr << "thread 2 entering\n";
+ std::cerr << "thread 2 entering\n";
 
- delay(1);
- {
- std::cerr << "thread 2 acquiring mutex...\n";
- scoped_lock lock(mtx);
- std::cerr << "thread 2 acquired mutex\n";
- delay(1);
- std::cerr << "thread 2 releasing mutex\n";
- }
- delay(1);
- {
- std::cerr << "thread 2 acquiring mutex...\n";
- scoped_lock lock(mtx);
- std::cerr << "thread 2 acquired mutex\n";
- delay(1);
- std::cerr << "thread 2 releasing mutex\n";
- }
- delay(1);
+ delay(1);
+ {
+ std::cerr << "thread 2 acquiring mutex...\n";
+ scoped_lock lock(mtx);
+ std::cerr << "thread 2 acquired mutex\n";
+ delay(1);
+ std::cerr << "thread 2 releasing mutex\n";
+ }
+ delay(1);
+ {
+ std::cerr << "thread 2 acquiring mutex...\n";
+ scoped_lock lock(mtx);
+ std::cerr << "thread 2 acquired mutex\n";
+ delay(1);
+ std::cerr << "thread 2 releasing mutex\n";
+ }
+ delay(1);
 
- std::cerr << "thread 2 leaving\n";
+ std::cerr << "thread 2 leaving\n";
 }
 
 int main()
 {
- std::cerr << "main() entering\n";
+ std::cerr << "main() entering\n";
 
- boost::thread th1(&thread1);
- std::cerr << "main() thread 1 started\n";
- boost::thread th2(&thread2);
- std::cerr << "main() thread 2 started\n";
- th1.join();
- th2.join();
+ boost::thread th1(&thread1);
+ std::cerr << "main() thread 1 started\n";
+ boost::thread th2(&thread2);
+ std::cerr << "main() thread 2 started\n";
+ th1.join();
+ th2.join();
 
- std::cerr << "main() leaving\n";
+ std::cerr << "main() leaving\n";
 }
 


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