THRIFT: Make the mutex assignable

Summary: we need to use a shared_ptr instead of an old fashioned one if we're
going to stick with this PIMPL model

Reviewed By: dreiss, marc

Test Plan: test program didn't fail or leak memory, foreman (fb303 client)
worked without problem

Revert Plan: just make sure you find some other solution to this problem


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665280 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/Mutex.h b/lib/cpp/src/concurrency/Mutex.h
index b19e3c5..dd35edb 100644
--- a/lib/cpp/src/concurrency/Mutex.h
+++ b/lib/cpp/src/concurrency/Mutex.h
@@ -7,6 +7,9 @@
 #ifndef _THRIFT_CONCURRENCY_MUTEX_H_
 #define _THRIFT_CONCURRENCY_MUTEX_H_ 1
 
+#include <boost/shared_ptr.hpp>
+using boost::shared_ptr;
+
 namespace facebook { namespace thrift { namespace concurrency { 
 
 /**
@@ -18,20 +21,21 @@
 class Mutex {
  public:
   Mutex();
-  virtual ~Mutex();
+  virtual ~Mutex() {}
   virtual void lock() const;
   virtual bool trylock() const;
   virtual void unlock() const;
 
  private:
+
   class impl;
-  impl* impl_;
+  shared_ptr<impl> impl_;
 };
 
 class ReadWriteMutex {
 public:
   ReadWriteMutex();
-  virtual ~ReadWriteMutex();
+  virtual ~ReadWriteMutex() {}
 
   // these get the lock and block until it is done successfully
   virtual void acquireRead() const;
@@ -45,8 +49,9 @@
   virtual void release() const;
    
 private:
+
   class impl;
-  impl* impl_;
+  shared_ptr<impl> impl_;
 };
 
 class Guard {
@@ -75,7 +80,7 @@
       rw_mutex_.release();
     }  
   private: 
-    const ReadWriteMutex rw_mutex_;
+    const ReadWriteMutex& rw_mutex_;
 };