From 42e9d0f5205453f68a87a7efb4ed0a64d4cf2903 Mon Sep 17 00:00:00 2001 From: Paul T Date: Thu, 2 Dec 2021 10:24:18 -0500 Subject: [PATCH 1/5] Improvements and Simplifications to ThreadPool Removed type definition of thread pool for thread_pool_impl. Simplified class by removing queue template parameter. Switched to using std::deque for task_queue objects so that we don't have to use unique_ptrs for those objects. Made pool non-copyable. Enqueue parameters by value for version that returns a future. Removed other unused type definitions. --- include/thread_pool/thread_pool.h | 68 +++++++++++++++---------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/include/thread_pool/thread_pool.h b/include/thread_pool/thread_pool.h index 16bc49a..317de8e 100644 --- a/include/thread_pool/thread_pool.h +++ b/include/thread_pool/thread_pool.h @@ -19,7 +19,7 @@ namespace dp { return std::forward(v); } - // Bind F and args... into a nullary one-shot lambda. Lambda captures by value. + // bind F and parameter pack into a nullary one shot. Lambda captures by value. template auto bind(F &&f, Args &&...args) { return [f = decay_copy(std::forward(f)), @@ -40,51 +40,49 @@ namespace dp { static_assert(detail::is_valid_queue>); } // namespace detail - template