Attach tasks from PipelineExecutor to thread group.

This commit is contained in:
Nikolai Kochetov 2019-04-29 14:04:03 +03:00
parent 0b8107c497
commit caf9ed639b

View File

@ -5,6 +5,7 @@
#include <Processors/printPipeline.h>
#include <Common/EventCounter.h>
#include <ext/scope_guard.h>
#include <Common/CurrentThread.h>
namespace DB
{
@ -187,7 +188,9 @@ void PipelineExecutor::addJob(UInt64 pid)
{
if (pool)
{
auto job = [this, pid]()
auto thread_group = CurrentThread::getGroup();
auto job = [this, pid, thread_group]()
{
SCOPE_EXIT(
{
@ -197,6 +200,9 @@ void PipelineExecutor::addJob(UInt64 pid)
event_counter.notify()
);
if (thread_group)
CurrentThread::attachToIfDetached(thread_group);
executeJob(graph[pid].processor);
};