You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/04/26 09:34:20 UTC

[GitHub] [incubator-doris] yangzhg commented on a diff in pull request #9193: [Feature]Add multi-thread probe to hash join

yangzhg commented on code in PR #9193:
URL: https://github.com/apache/incubator-doris/pull/9193#discussion_r858500882


##########
be/src/vec/exec/join/vhash_join_node.cpp:
##########
@@ -636,6 +653,58 @@ struct ProcessHashTableProbe {
     ProfileCounter* _probe_side_output_timer;
 };
 
+class ProbeThreadPool {
+public:
+    typedef std::function<void(int thread_id)> WorkFunction;
+    struct Task {
+    public:
+        WorkFunction work_function;
+    };
+
+    ProbeThreadPool(uint32_t num_threads, uint32_t queue_size)
+            : _work_queue(queue_size), _shutdown(false) {
+        for (int i = 0; i < num_threads; ++i) {
+            _threads.create_thread(
+                    std::bind<void>(std::mem_fn(&ProbeThreadPool::work_thread), this, i));
+        }
+    }
+
+    ~ProbeThreadPool() {
+        shutdown();
+        join();
+    }
+
+    bool offer(Task task) { return _work_queue.blocking_put(task); }
+
+    void shutdown() {
+        _shutdown = true;
+        _work_queue.shutdown();
+    }
+
+    virtual void join() { _threads.join_all(); }

Review Comment:
   why this method virtual



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org