szaszm commented on a change in pull request #1044:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1044#discussion_r629524670



##########
File path: extensions/systemd/WorkerThread.h
##########
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "utils/MinifiConcurrentQueue.h"
+
+#include <future>
+#include <thread>
+
+namespace org { namespace apache { namespace nifi { namespace minifi { 
namespace extensions { namespace systemd {
+
+namespace detail {
+class WorkerThread final {
+ public:
+  WorkerThread();
+
+  WorkerThread(const WorkerThread&) = delete;
+  WorkerThread(WorkerThread&&) = delete;
+  WorkerThread& operator=(WorkerThread) = delete;
+
+  ~WorkerThread();
+
+  template<typename... Args>
+  void enqueue(Args&& ... args) { work_.enqueue(std::forward<Args>(args)...); }
+
+ private:
+  void run() noexcept;
+
+  utils::ConditionConcurrentQueue<std::packaged_task<void()>> work_;

Review comment:
       I thought of work as uncountable in this context, but the queue indeed 
contains units of work. I normally prefer not to repeat information in the name 
that's already in the type, but since you understood it differently than I, 
it's probably a good idea to rename it.
   Renaming to `task_queue_`, because I realized that the units of work are 
tasks. Let me know if you don't like this name.
   5147b60bb




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to