Commit 9a096e58 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Let CPUThreadPoolExecutor use unbounded queues

Summary:
[Folly] Let CPUThreadPoolExecutor use unbounded queues when no queue bounds are specified.

One constructor remains which specifies queue bounds; that constructor uses bounded queues.

Reviewed By: andriigrynenko

Differential Revision: D15113118

fbshipit-source-id: 9c8ace4f170fdfdeef152e55b371d434ad248866
parent 82a53425
......@@ -17,6 +17,8 @@
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/executors/task_queue/PriorityLifoSemMPMCQueue.h>
#include <folly/executors/task_queue/PriorityUnboundedBlockingQueue.h>
#include <folly/executors/task_queue/UnboundedBlockingQueue.h>
#include <folly/portability/GFlags.h>
DEFINE_bool(
......@@ -57,8 +59,7 @@ CPUThreadPoolExecutor::CPUThreadPoolExecutor(
std::shared_ptr<ThreadFactory> threadFactory)
: CPUThreadPoolExecutor(
numThreads,
std::make_unique<LifoSemMPMCQueue<CPUTask>>(
CPUThreadPoolExecutor::kDefaultMaxQueueSize),
std::make_unique<UnboundedBlockingQueue<CPUTask>>(),
std::move(threadFactory)) {}
CPUThreadPoolExecutor::CPUThreadPoolExecutor(
......@@ -66,8 +67,7 @@ CPUThreadPoolExecutor::CPUThreadPoolExecutor(
std::shared_ptr<ThreadFactory> threadFactory)
: CPUThreadPoolExecutor(
numThreads,
std::make_unique<LifoSemMPMCQueue<CPUTask>>(
CPUThreadPoolExecutor::kDefaultMaxQueueSize),
std::make_unique<UnboundedBlockingQueue<CPUTask>>(),
std::move(threadFactory)) {}
CPUThreadPoolExecutor::CPUThreadPoolExecutor(size_t numThreads)
......@@ -81,9 +81,8 @@ CPUThreadPoolExecutor::CPUThreadPoolExecutor(
std::shared_ptr<ThreadFactory> threadFactory)
: CPUThreadPoolExecutor(
numThreads,
std::make_unique<PriorityLifoSemMPMCQueue<CPUTask>>(
numPriorities,
CPUThreadPoolExecutor::kDefaultMaxQueueSize),
std::make_unique<PriorityUnboundedBlockingQueue<CPUTask>>(
numPriorities),
std::move(threadFactory)) {}
CPUThreadPoolExecutor::CPUThreadPoolExecutor(
......
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