ClickHouse/src/Interpreters/threadPoolCallbackRunner.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
551 B
C++
Raw Normal View History

#pragma once
#include <Common/ThreadPool.h>
2022-09-07 15:44:29 +00:00
#include <future>
namespace DB
{
2022-09-07 15:44:29 +00:00
/// High-order function to run callbacks (functions with 'void()' signature) somewhere asynchronously.
template <typename Result>
using ThreadPoolCallbackRunner = std::function<std::future<Result>(std::function<Result()> &&, size_t priority)>;
2022-09-07 15:44:29 +00:00
/// Creates CallbackRunner that runs every callback with 'pool->scheduleOrThrow()'.
template <typename Result>
ThreadPoolCallbackRunner<Result> threadPoolCallbackRunner(ThreadPool & pool, const std::string & thread_name);
}