2017-12-12 23:23:57 +03:00
|
|
|
/*
|
2019-06-20 02:58:25 +03:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2017-12-12 23:23:57 +03:00
|
|
|
*
|
2019-06-20 02:58:25 +03:00
|
|
|
* This software may be used and distributed according to the terms of the
|
|
|
|
* GNU General Public License version 2.
|
2017-12-12 23:23:57 +03:00
|
|
|
*/
|
2019-10-11 15:26:59 +03:00
|
|
|
|
2018-08-03 23:08:37 +03:00
|
|
|
#include "eden/fs/utils/UnboundedQueueExecutor.h"
|
2017-12-12 23:23:57 +03:00
|
|
|
|
2018-08-03 23:08:37 +03:00
|
|
|
#include <folly/executors/CPUThreadPoolExecutor.h>
|
|
|
|
#include <folly/executors/ManualExecutor.h>
|
2017-12-12 23:23:57 +03:00
|
|
|
#include <folly/executors/task_queue/UnboundedBlockingQueue.h>
|
|
|
|
#include <folly/executors/thread_factory/NamedThreadFactory.h>
|
|
|
|
|
|
|
|
namespace facebook {
|
|
|
|
namespace eden {
|
|
|
|
|
2018-08-03 23:08:37 +03:00
|
|
|
UnboundedQueueExecutor::UnboundedQueueExecutor(
|
2017-12-12 23:23:57 +03:00
|
|
|
size_t threadCount,
|
|
|
|
folly::StringPiece threadNamePrefix)
|
2018-08-03 23:08:37 +03:00
|
|
|
: executor_{std::make_unique<folly::CPUThreadPoolExecutor>(
|
2017-12-12 23:23:57 +03:00
|
|
|
threadCount,
|
|
|
|
std::make_unique<folly::UnboundedBlockingQueue<
|
|
|
|
folly::CPUThreadPoolExecutor::CPUTask>>(),
|
2018-08-03 23:08:37 +03:00
|
|
|
std::make_unique<folly::NamedThreadFactory>(threadNamePrefix))} {}
|
|
|
|
|
|
|
|
UnboundedQueueExecutor::UnboundedQueueExecutor(
|
2018-08-21 22:10:21 +03:00
|
|
|
std::shared_ptr<folly::ManualExecutor> executor)
|
2018-08-03 23:08:37 +03:00
|
|
|
: executor_{std::move(executor)} {}
|
2017-12-12 23:23:57 +03:00
|
|
|
|
|
|
|
} // namespace eden
|
|
|
|
} // namespace facebook
|