mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 16:31:02 +03:00
fbdb46f5cb
Reviewed By: chadaustin Differential Revision: D17872966 fbshipit-source-id: cd60a364a2146f0dadbeca693b1d4a5d7c97ff63
33 lines
1.0 KiB
C++
33 lines
1.0 KiB
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This software may be used and distributed according to the terms of the
|
|
* GNU General Public License version 2.
|
|
*/
|
|
|
|
#include "eden/fs/utils/UnboundedQueueExecutor.h"
|
|
|
|
#include <folly/executors/CPUThreadPoolExecutor.h>
|
|
#include <folly/executors/ManualExecutor.h>
|
|
#include <folly/executors/task_queue/UnboundedBlockingQueue.h>
|
|
#include <folly/executors/thread_factory/NamedThreadFactory.h>
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
UnboundedQueueExecutor::UnboundedQueueExecutor(
|
|
size_t threadCount,
|
|
folly::StringPiece threadNamePrefix)
|
|
: executor_{std::make_unique<folly::CPUThreadPoolExecutor>(
|
|
threadCount,
|
|
std::make_unique<folly::UnboundedBlockingQueue<
|
|
folly::CPUThreadPoolExecutor::CPUTask>>(),
|
|
std::make_unique<folly::NamedThreadFactory>(threadNamePrefix))} {}
|
|
|
|
UnboundedQueueExecutor::UnboundedQueueExecutor(
|
|
std::shared_ptr<folly::ManualExecutor> executor)
|
|
: executor_{std::move(executor)} {}
|
|
|
|
} // namespace eden
|
|
} // namespace facebook
|