Add element construction/destruction hooks to IndexedMemPool
[folly.git] / folly / experimental / RCUUtils.cpp
index 2f0593c9aae7f7fa835cc79ceef3a7cc7ea557e3..c49638f6d3f8340945e0baff14928f8aae62d4b0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2017 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 {
@@ -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;
+}
 }