cmake: fix the test builds
[folly.git] / folly / experimental / RCUUtils.cpp
index 782bb05b92afa7f4064bdf88974aef9fb037ecfe..e929b3f953c7e20675850e04542bc53b19a8be69 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2015-present Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 #include <folly/experimental/RCUUtils.h>
 
-#include <folly/Portability.h>
 #include <folly/ThreadLocal.h>
 
-
 namespace folly {
 
 namespace {
@@ -35,7 +33,7 @@ struct RCURegisterThreadHelper {
   bool alive{false};
 };
 
-}
+} // namespace
 
 bool RCURegisterThread() {
   static folly::ThreadLocal<RCURegisterThreadHelper>* rcuRegisterThreadHelper =
@@ -49,4 +47,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;
 }
+} // namespace folly