mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-16 03:12:43 +00:00
19 lines
551 B
C++
19 lines
551 B
C++
#pragma once
|
|
|
|
#include <Common/ThreadPool.h>
|
|
#include <future>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/// 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)>;
|
|
|
|
/// Creates CallbackRunner that runs every callback with 'pool->scheduleOrThrow()'.
|
|
template <typename Result>
|
|
ThreadPoolCallbackRunner<Result> threadPoolCallbackRunner(ThreadPool & pool, const std::string & thread_name);
|
|
|
|
}
|