Summary:
In the past, these calls were required.
Used to solve static destruction ordering issue. Any static object that uses RequestContext must call this function in its constructor.
That is when we were using `static folly::ThreadLocal<std::shared_ptr<RequestContext>>`, which was non-leaky.
The problem being addressed is when we have some code of the form:
```lang=c++
void doWork() {
static EventBase eb;
}
```
But now we are using `SingletonThreadLocal<std::shared_ptr<RequestContext>>`, which is leaky.
So the issue that these calls were there to address seems to have been resolved.
Reviewed By: yfeldblum
Differential Revision:
D6332597
fbshipit-source-id:
c6aba6620ef2fb3a344ea20f56c8b9c0cdf42c70
timeoutManager_->attachTimeoutManager(
this,
TimeoutManager::InternalEnum::NORMAL);
timeoutManager_->attachTimeoutManager(
this,
TimeoutManager::InternalEnum::NORMAL);
- RequestContext::saveContext();
}
AsyncTimeout::AsyncTimeout(EventBase* eventBase)
}
AsyncTimeout::AsyncTimeout(EventBase* eventBase)
this,
TimeoutManager::InternalEnum::NORMAL);
}
this,
TimeoutManager::InternalEnum::NORMAL);
}
- RequestContext::saveContext();
}
AsyncTimeout::AsyncTimeout(TimeoutManager* timeoutManager,
}
AsyncTimeout::AsyncTimeout(TimeoutManager* timeoutManager,
&event_, -1, EV_TIMEOUT, &AsyncTimeout::libeventCallback, this);
event_.ev_base = nullptr;
timeoutManager_->attachTimeoutManager(this, internal);
&event_, -1, EV_TIMEOUT, &AsyncTimeout::libeventCallback, this);
event_.ev_base = nullptr;
timeoutManager_->attachTimeoutManager(this, internal);
- RequestContext::saveContext();
}
AsyncTimeout::AsyncTimeout(EventBase* eventBase, InternalEnum internal)
}
AsyncTimeout::AsyncTimeout(EventBase* eventBase, InternalEnum internal)
&event_, -1, EV_TIMEOUT, &AsyncTimeout::libeventCallback, this);
event_.ev_base = nullptr;
timeoutManager_->attachTimeoutManager(this, internal);
&event_, -1, EV_TIMEOUT, &AsyncTimeout::libeventCallback, this);
event_.ev_base = nullptr;
timeoutManager_->attachTimeoutManager(this, internal);
- RequestContext::saveContext();
}
AsyncTimeout::AsyncTimeout(): timeoutManager_(nullptr) {
folly_event_set(
&event_, -1, EV_TIMEOUT, &AsyncTimeout::libeventCallback, this);
event_.ev_base = nullptr;
}
AsyncTimeout::AsyncTimeout(): timeoutManager_(nullptr) {
folly_event_set(
&event_, -1, EV_TIMEOUT, &AsyncTimeout::libeventCallback, this);
event_.ev_base = nullptr;
- RequestContext::saveContext();
}
AsyncTimeout::~AsyncTimeout() {
}
AsyncTimeout::~AsyncTimeout() {
}
VLOG(5) << "EventBase(): Created.";
initNotificationQueue();
}
VLOG(5) << "EventBase(): Created.";
initNotificationQueue();
- RequestContext::saveContext();
}
// takes ownership of the event_base
}
// takes ownership of the event_base
throw std::invalid_argument("EventBase(): event base cannot be nullptr");
}
initNotificationQueue();
throw std::invalid_argument("EventBase(): event base cannot be nullptr");
}
initNotificationQueue();
- RequestContext::saveContext();
}
EventBase::~EventBase() {
}
EventBase::~EventBase() {
pid_(pid_t(getpid())),
queue_() {
pid_(pid_t(getpid())),
queue_() {
- RequestContext::saveContext();
-
#ifdef FOLLY_HAVE_EVENTFD
if (fdType == FdType::EVENTFD) {
eventfd_ = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
#ifdef FOLLY_HAVE_EVENTFD
if (fdType == FdType::EVENTFD) {
eventfd_ = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);