More test code added...
     more bugs found

facebook::thrift::concurrency::ThreadManager::add
	Fixed dispatch error that resulted in only one of N worker threads ever getting notified of work

facebook::thrift::concurrency::ThreadManager
	Cleaned up addWorker/removeWorker and stop logic so that adding/removing workers doesn't wake up 
	all blocked workers.

facebook::thrift::concurrency::Thread
facebook::thrift::concurrency::Runnable
	Fixed initialization logic so that runnable can return the thread that runs it


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664729 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/Thread.h b/lib/cpp/src/concurrency/Thread.h
index 8237091..2416887 100644
--- a/lib/cpp/src/concurrency/Thread.h
+++ b/lib/cpp/src/concurrency/Thread.h
@@ -17,6 +17,18 @@
   virtual ~Runnable() {};
 
   virtual void run() = 0;
+
+  virtual Thread* thread() {return _thread;}
+
+ private:
+
+  /** Sets the thread that is executing this object.  This is only meant for use by concrete implementations of Thread. */
+
+  friend class Thread;
+
+  virtual void thread(Thread* value) {_thread = value;}
+
+  Thread* _thread;
 };
 
 /** Minimal thread class.  Returned by thread factory bound to a Runnable object and ready to start execution.  More or less analogous to java.lang.Thread
@@ -43,7 +55,15 @@
 
   /** Gets the runnable object this thread is hosting */
   
-  virtual Runnable* runnable() const = 0;
+  virtual Runnable* runnable() const {return _runnable;}
+
+ protected:
+
+  virtual void runnable(Runnable* value, bool x=false) {_runnable = value; _runnable->thread(this);}
+
+ private:
+  
+  Runnable* _runnable;
 };
 
 /** Factory to create platform-specific thread object and bind them to Runnable object for execution */