Fixed a few problems found on linux x86_64 version


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664728 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/ThreadManager.cc b/lib/cpp/src/concurrency/ThreadManager.cc
index 69a96ff..0aa4bef 100644
--- a/lib/cpp/src/concurrency/ThreadManager.cc
+++ b/lib/cpp/src/concurrency/ThreadManager.cc
@@ -164,7 +164,7 @@
 
       _manager->_workerCount++;
 
-      _manager->_monitor.notify();
+      _manager->_monitor.notifyAll();
     }
 
     do {
@@ -358,10 +358,8 @@
     /* If queue was empty notify a thread, otherwise all worker threads are running and will get around to this
        task in time. */
 
-    if(isEmpty) {
+    if(isEmpty && _idleCount > 0) {
 
-      assert(_idleCount == _workerCount);
-      
       _monitor.notify();
     }
   }
diff --git a/lib/cpp/src/concurrency/Util.h b/lib/cpp/src/concurrency/Util.h
index d04435d..8467a2c 100644
--- a/lib/cpp/src/concurrency/Util.h
+++ b/lib/cpp/src/concurrency/Util.h
@@ -2,6 +2,7 @@
 #define _concurrency_Util_h_ 1
 
 #include <assert.h>
+#include <stddef.h>
 #include <sys/time.h>
 
 namespace facebook { namespace thrift { namespace concurrency { 
diff --git a/lib/cpp/src/concurrency/test/Tests.cc b/lib/cpp/src/concurrency/test/Tests.cc
index 02e1724..d139f55 100644
--- a/lib/cpp/src/concurrency/test/Tests.cc
+++ b/lib/cpp/src/concurrency/test/Tests.cc
@@ -30,9 +30,11 @@
 
     assert(threadFactoryTests.helloWorldTest());
 
-    std::cout << "\t\tThreadFactory reap N threads test: N = 100" << std::endl;
+    size_t count =  10000;
 
-    assert(threadFactoryTests.reapNThreads(100));
+    std::cout << "\t\tThreadFactory reap N threads test: N = " << count << std::endl;
+
+    assert(threadFactoryTests.reapNThreads(count));
 
     std::cout << "\t\tThreadFactory synchrous start test" << std::endl;
 
diff --git a/lib/cpp/src/concurrency/test/ThreadFactoryTests.h b/lib/cpp/src/concurrency/test/ThreadFactoryTests.h
index 0d93564..1e0b139 100644
--- a/lib/cpp/src/concurrency/test/ThreadFactoryTests.h
+++ b/lib/cpp/src/concurrency/test/ThreadFactoryTests.h
@@ -83,7 +83,7 @@
     int& _count;
   };
 
-  bool reapNThreads(int count=100) {
+  bool reapNThreads(int count=10) {
 
     Monitor* monitor = new Monitor();
 
@@ -127,11 +127,11 @@
   public:
 
     enum STATE {
-      UNINITIALIZED = 1000,
-      STARTING = 1001,
-      STARTED = 1002,
-      STOPPING = 1003,
-      STOPPED = 1004
+      UNINITIALIZED,
+      STARTING,
+      STARTED,
+      STOPPING,
+      STOPPED
     };
 
   SynchStartTask(Monitor& monitor,