Adds writer test case for RCU
[folly.git] / folly / io / async / EventBaseLocal.cpp
index cda6311375a7621bcac8d462691ffd69a7a0d5f6..8b21fc18b781bd48c43cc56b642749dc986a4776 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 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.
@@ -22,7 +22,8 @@
 namespace folly { namespace detail {
 
 EventBaseLocalBase::~EventBaseLocalBase() {
-  for (auto* evb : *eventBases_.rlock()) {
+  auto locked = eventBases_.rlock();
+  for (auto* evb : *locked) {
     evb->runInEventBaseThread([ this, evb, key = key_ ] {
       evb->localStorage_.erase(key);
       evb->localStorageToDtor_.erase(this);