From e4431011e41842cf1f7e0f3ac1eba097568a1a56 Mon Sep 17 00:00:00 2001 From: Andrew Gallagher Date: Wed, 26 Oct 2016 01:24:23 -0700 Subject: [PATCH] Move inline functions with static-locals to implementation files 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 | 6 ++++++ folly/experimental/RCUUtils.h | 7 +------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/folly/experimental/RCUUtils.cpp b/folly/experimental/RCUUtils.cpp index 782bb05b..48ae846a 100644 --- a/folly/experimental/RCUUtils.cpp +++ b/folly/experimental/RCUUtils.cpp @@ -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; +} } diff --git a/folly/experimental/RCUUtils.h b/folly/experimental/RCUUtils.h index 74cc788f..21b22525 100644 --- a/folly/experimental/RCUUtils.h +++ b/folly/experimental/RCUUtils.h @@ -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); -- 2.34.1