Commit f2986876 authored by Aditya Kumar's avatar Aditya Kumar Committed by Facebook Github Bot

Report when loopBody is called incorrectly

Reviewed By: yfeldblum

Differential Revision: D17651558

fbshipit-source-id: 7c4ed2a5fbe2ddd843dc3b5f5eb53c87438197f0
parent 47cc2cd2
...@@ -279,13 +279,16 @@ bool EventBase::loopOnce(int flags) { ...@@ -279,13 +279,16 @@ bool EventBase::loopOnce(int flags) {
bool EventBase::loopBody(int flags, bool ignoreKeepAlive) { bool EventBase::loopBody(int flags, bool ignoreKeepAlive) {
VLOG(5) << "EventBase(): Starting loop."; VLOG(5) << "EventBase(): Starting loop.";
DCHECK(!invokingLoop_) const char* message =
<< "Your code just tried to loop over an event base from inside another " "Your code just tried to loop over an event base from inside another "
<< "event base loop. Since libevent is not reentrant, this leads to " "event base loop. Since libevent is not reentrant, this leads to "
<< "undefined behavior in opt builds. Please fix immediately. For the " "undefined behavior in opt builds. Please fix immediately. For the "
<< "common case of an inner function that needs to do some synchronous " "common case of an inner function that needs to do some synchronous "
<< "computation on an event-base, replace getEventBase() by a new, " "computation on an event-base, replace getEventBase() by a new, "
<< "stack-allocated EvenBase."; "stack-allocated EvenBase.";
LOG_IF(DFATAL, invokingLoop_) << message;
invokingLoop_ = true; invokingLoop_ = true;
SCOPE_EXIT { SCOPE_EXIT {
invokingLoop_ = false; invokingLoop_ = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment