summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2009-12-02 15:15:24 -0500
committerMathias Stearn <mathias@10gen.com>2009-12-02 15:28:28 -0500
commit04c6bf7241c9603b1cbafa045320a16b0536c150 (patch)
treeed8a9436c6e5538cd4a58f669ae1447e1e1056d1
parentac1f4db189a9e0d810026d862151ba860209d7c1 (diff)
downloadmongo-04c6bf7241c9603b1cbafa045320a16b0536c150.tar.gz
Fix for boost 1.33
-rw-r--r--dbtests/threadedtests.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/dbtests/threadedtests.cpp b/dbtests/threadedtests.cpp
index a3e8562c8f8..cbdeeedda91 100644
--- a/dbtests/threadedtests.cpp
+++ b/dbtests/threadedtests.cpp
@@ -37,21 +37,26 @@ namespace ThreadedTests {
void run(){
setup();
- boost::thread threads[nthreads];
- for(int i=0; i < nthreads; i++){
- boost::thread athread(boost::bind(&ThreadedTest::subthread, this));
- threads[i].swap(athread);
- }
-
- for(int i=0; i < nthreads; i++)
- threads[i].join();
+ launch_subthreads(nthreads);
validate();
}
virtual ~ThreadedTest() {}; // not necessary, but makes compilers happy
+
+ private:
+ void launch_subthreads(int remaining){
+ if (!remaining) return;
+
+ boost::thread athread(boost::bind(&ThreadedTest::subthread, this));
+
+ launch_subthreads(remaining - 1);
+
+ athread.join();
+ }
};
+ // Tested with up to 30k threads
class IsWrappingIntAtomic : public ThreadedTest<> {
static const int iterations = 1000000;
WrappingInt target;