Move inline functions with static-locals to implementation files
authorAndrew Gallagher <andrewjcg@fb.com>
Wed, 26 Oct 2016 08:24:23 +0000 (01:24 -0700)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Wed, 26 Oct 2016 08:38:30 +0000 (01:38 -0700)
Summary:
This refactors inline functions defined in headers which had static locals
so that their definition is moved to the corresponding implementation file.

Reviewed By: yfeldblum

Differential Revision: D4049175

fbshipit-source-id: 56eeb82eb23b04c3b9940d803d05050949aa5ef9

folly/experimental/RCUUtils.cpp
folly/experimental/RCUUtils.h

index 782bb05b92afa7f4064bdf88974aef9fb037ecfe..48ae846ac8022cb8d7677b954c25fec7114f34a5 100644 (file)
@@ -49,4 +49,10 @@ bool RCURegisterThread() {
   return ret;
 }
 
+RCUReadLock& RCUReadLock::instance() {
+  // Both lock and unlock are static, so no need to worry about destruction
+  // order
+  static RCUReadLock instance;
+  return instance;
+}
 }
index 74cc788f1a9b2eb72d654d856510b4dedf38375c..21b2252575783644c2efa37f4c6b9ad5dc0cbe27 100644 (file)
@@ -30,12 +30,7 @@ bool RCURegisterThread();
 
 class RCUReadLock {
  public:
-  static RCUReadLock& instance() {
-    // Both lock and unlock are static, so no need to worry about destruction
-    // order
-    static RCUReadLock instance;
-    return instance;
-  }
+  static RCUReadLock& instance();
 
   static void lock() {
     assert(RCURegisterThread() == false);