/*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2017-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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
idleStart = std::chrono::steady_clock::now();
}
- while (!stop_.load(std::memory_order_acquire)) {
+ while (!stop_.load(std::memory_order_relaxed)) {
applyLoopKeepAlive();
++nextLoopCnt_;
}
}
// Reset stop_ so loop() can be called again
- stop_ = false;
+ stop_.store(false, std::memory_order_relaxed);
if (res < 0) {
LOG(ERROR) << "EventBase: -- error in event loop, res = " << res;
VLOG(5) << "EventBase(): Received terminateLoopSoon() command.";
// Set stop to true, so the event loop will know to exit.
- // TODO: We should really use an atomic operation here with a release
- // barrier.
- stop_ = true;
+ stop_.store(true, std::memory_order_relaxed);
// Call event_base_loopbreak() so that libevent will exit the next time
// around the loop.