Use Baton (again) in EventBase::runInEventBaseThreadAndWait
[folly.git] / folly / io / async / Request.h
index a87ec7338b40a655f204ed5ea3ec7d5ecdc91a52..a4b7a23a17d78aadd340ede0b697fa7bf10b7be2 100644 (file)
@@ -1,23 +1,19 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2004-present Facebook, Inc.
  *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
  *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
+
 #pragma once
 
 #include <map>
@@ -34,6 +30,10 @@ namespace folly {
 class RequestData {
  public:
   virtual ~RequestData() = default;
+  // Avoid calling RequestContext::setContextData, setContextDataIfAbsent, or
+  // clearContextData from these callbacks. Doing so will cause deadlock. We
+  // could fix these deadlocks, but only at significant performance penalty, so
+  // just don't do it!
   virtual void onSet() {}
   virtual void onUnset() {}
 };
@@ -115,8 +115,6 @@ class RequestContextScopeGuard {
   // Create a new RequestContext and reset to the original value when
   // this goes out of scope.
   RequestContextScopeGuard() : prev_(RequestContext::saveContext()) {
-    DLOG_IF(INFO, prev_ != nullptr)
-        << "Overriding folly::RequestContext - did you mean to unset it first?";
     RequestContext::create();
   }
 
@@ -124,8 +122,6 @@ class RequestContextScopeGuard {
   // be automatically reset to the original value when this goes out of scope.
   explicit RequestContextScopeGuard(std::shared_ptr<RequestContext> ctx)
       : prev_(RequestContext::setContext(std::move(ctx))) {
-    DLOG_IF(INFO, prev_ != nullptr && prev_.get() != RequestContext::get())
-        << "Overriding folly::RequestContext - did you mean to unset it first?";
   }
 
   ~RequestContextScopeGuard() {