Use SharedMutex as the default mutex type in Synchronized
authorYedidya Feldblum <yfeldblum@fb.com>
Thu, 10 Dec 2015 20:15:41 +0000 (12:15 -0800)
committerfacebook-github-bot-1 <folly-bot@fb.com>
Thu, 10 Dec 2015 21:20:22 +0000 (13:20 -0800)
Summary:
[Folly] Use `SharedMutex` as the default mutex type in `Synchronized`.

`folly::SharedMutex` is, overall, a faster mutex than `boost::shared_mutex`. Let's upgrade.

Reviewed By: nbronson

Differential Revision: D2743132

fb-gh-sync-id: e36881495e8e1002cd481607e05e555c5da19b9a

folly/Synchronized.h

index 109cea7c530d10859ba6cf08765581dc541e0656..668f67409c6e513f70269878986a8cd57ecf15af 100644 (file)
@@ -28,6 +28,7 @@
 #include <mutex>
 #include <boost/thread.hpp>
 #include <folly/Preprocessor.h>
+#include <folly/SharedMutex.h>
 #include <folly/Traits.h>
 
 namespace folly {
@@ -224,7 +225,7 @@ releaseReadWrite(T& mutex) {
  * refer to the namespace detail below, which implements the
  * primitives for mutexes in std and boost.
  */
-template <class T, class Mutex = boost::shared_mutex>
+template <class T, class Mutex = SharedMutex>
 struct Synchronized {
   /**
    * Default constructor leaves both members call their own default