From 6fdb7f1c8c8de5824be52ffd79e6d49963eca8ff Mon Sep 17 00:00:00 2001 From: Martin Zink Date: Wed, 19 Jul 2023 14:46:40 +0200 Subject: [PATCH] reverted decltype change in ThreadPool.h due to warning --- libminifi/include/utils/ThreadPool.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libminifi/include/utils/ThreadPool.h b/libminifi/include/utils/ThreadPool.h index 22627610fea..cafcb2b94e5 100644 --- a/libminifi/include/utils/ThreadPool.h +++ b/libminifi/include/utils/ThreadPool.h @@ -106,6 +106,13 @@ class Worker { std::shared_ptr> promise; }; +class DelayedTaskComparator { + public: + bool operator()(Worker &a, Worker &b) { + return a.getNextExecutionTime() > b.getNextExecutionTime(); + } +}; + class WorkerThread { public: explicit WorkerThread(std::thread thread, const std::string &name = "NamelessWorker") @@ -270,9 +277,7 @@ class ThreadPool { std::shared_ptr thread_manager_; ConcurrentQueue> deceased_thread_queue_; ConditionConcurrentQueue worker_queue_; - std::priority_queue, - /* comparator: */ decltype([](const Worker& lhs, const Worker& rhs) noexcept { return lhs.getNextExecutionTime() > rhs.getNextExecutionTime(); }) - > delayed_worker_queue_; + std::priority_queue, DelayedTaskComparator> delayed_worker_queue_; std::mutex worker_queue_mutex_; std::condition_variable delayed_task_available_; std::map task_status_;