Trying to improve the efficiency of RequestContext callbacks
authorMirek Klimos <miro@fb.com>
Fri, 4 Nov 2016 18:10:46 +0000 (11:10 -0700)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Fri, 4 Nov 2016 18:23:26 +0000 (11:23 -0700)
Summary: Changed RWSpinLock to a SharedMutex in the RequestContext to see if this would lower the overhead of the onSet/onUnset callbacks.

Reviewed By: djwatson

Differential Revision: D3780396

fbshipit-source-id: 3d91f8194357533072fe053d23e0454a36faecff

folly/io/async/Request.h

index 59d66f94fce53bacb9ba9c6e38173eccb5824dc4..67f220d44f23d1c3c294baa974a9a2ea312c6338 100644 (file)
@@ -23,7 +23,7 @@
 #include <map>
 #include <memory>
 
-#include <folly/RWSpinLock.h>
+#include <folly/SharedMutex.h>
 #include <folly/Synchronized.h>
 
 namespace folly {
@@ -99,7 +99,7 @@ class RequestContext {
   static std::shared_ptr<RequestContext>& getStaticContext();
 
   using Data = std::map<std::string, std::unique_ptr<RequestData>>;
-  folly::Synchronized<Data, folly::RWSpinLock> data_;
+  folly::Synchronized<Data, folly::SharedMutex> data_;
 };
 
 class RequestContextScopeGuard {