mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
bfc189cc92
Summary: As a prerequisite to running inode unloading code in a background queue, use a deterministic executor in TestMount to make sequencing in unit tests reliable. Reviewed By: simpkins Differential Revision: D9323878 fbshipit-source-id: 0b85632c1637a8cf83d6f238675e5b6bbb6923c7
35 lines
1.2 KiB
C++
35 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) 2017-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
*/
|
|
#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
|