Modified PosixThreadFactory::PThread:
        Pay attention to detached flags.  If thread is create non-detached and has not been joined when all references are given up,
        (ie boost::share_ptr calls ~PThread) do the join in the destructor to prevent thread ids from being leaked.

Modified ThreadFactoryTests.reapNThreads:
        Loop M times for M threads where M x N is bigger than 32K to verify that thread ids aren't leaked

Modified TimerManager.cpp:
        Removed debug messages.

Reviewed By: mcslee

Revert Plan: revertible

Test Plan: concurrency_test thread-factory passes


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665129 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/TimerManager.cpp b/lib/cpp/src/concurrency/TimerManager.cpp
index 2134e37..b9e604c 100644
--- a/lib/cpp/src/concurrency/TimerManager.cpp
+++ b/lib/cpp/src/concurrency/TimerManager.cpp
@@ -40,8 +40,6 @@
     state_(WAITING) {}
   
   ~Task() {
-    //debug
-    std::cerr << "TimerManager::Task.dtor[" << this << "]" << std::endl; 
   }
   
   void run() {
@@ -64,10 +62,7 @@
   Dispatcher(TimerManager* manager) : 
     manager_(manager) {}
   
-  ~Dispatcher() {
-    // debug
-    std::cerr << "Dispatcher::dtor[" << this << "]" << std::endl;
-  }
+  ~Dispatcher() {}
   
   /**
    * Dispatcher entry point
@@ -148,13 +143,11 @@
 
   // If we haven't been explicitly stopped, do so now.  We don't need to grab
   // the monitor here, since stop already takes care of reentrancy.
-  std::cerr << "TimerManager::dtor[" << this << "]" << std::endl;
   
   if (state_ != STOPPED) {
     try {
       stop();
     } catch(...) {
-      std::cerr << "TimerManager::dtor[" << this << "] uhoh " << std::endl;
       throw;
       // uhoh
     }