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