Commit f244bdc6 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot

Give observer manager threads a name

Summary: Re-landing D4618623 after it had to be reverted due to it's use of `FixedString`, which had broken GCC 4.8. `FixedString` should now be compiling correctly on GCC 4.8 so this should be fine now.

Reviewed By: yfeldblum

Differential Revision: D4727022

fbshipit-source-id: f85c6952fd82e6cd6042f8055ef54d9422f8b0f9
parent 1d3ca26b
......@@ -16,8 +16,11 @@
#include <folly/experimental/observer/detail/ObserverManager.h>
#include <folly/ExceptionString.h>
#include <folly/Format.h>
#include <folly/MPMCQueue.h>
#include <folly/Range.h>
#include <folly/Singleton.h>
#include <folly/ThreadName.h>
#include <folly/portability/GFlags.h>
namespace folly {
......@@ -32,6 +35,8 @@ DEFINE_int32(
4,
"How many internal threads ObserverManager should use");
static constexpr StringPiece kObserverManagerThreadNamePrefix{"ObserverMngr"};
namespace {
constexpr size_t kCurrentQueueSize{10 * 1024};
constexpr size_t kNextQueueSize{10 * 1024};
......@@ -45,7 +50,9 @@ class ObserverManager::CurrentQueue {
FLAGS_observer_manager_pool_size = 1;
}
for (int32_t i = 0; i < FLAGS_observer_manager_pool_size; ++i) {
threads_.emplace_back([&]() {
threads_.emplace_back([this, i]() {
folly::setThreadName(
folly::sformat("{}{}", kObserverManagerThreadNamePrefix, i));
ObserverManager::inManagerThread_ = true;
while (true) {
......
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