+void EventBase::checkIsInEventBaseThread() const {
+ auto evbTid = loopThread_.load(std::memory_order_relaxed);
+ if (evbTid == std::thread::id()) {
+ return;
+ }
+
+ // Using getThreadName(evbTid) instead of name_ will work also if
+ // the thread name is set outside of EventBase (and name_ is empty).
+ auto curTid = std::this_thread::get_id();
+ CHECK(evbTid == curTid)
+ << "This logic must be executed in the event base thread. "
+ << "Event base thread name: \""
+ << folly::getThreadName(evbTid).value_or("")
+ << "\", current thread name: \""
+ << folly::getThreadName(curTid).value_or("") << "\"";
+}
+