42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "lib/config/protos/threads.pb.h"
|
|
#include <functional>
|
|
#include <string>
|
|
#include <thread>
|
|
|
|
namespace bts {
|
|
namespace config {
|
|
class ThreadGroupCfg;
|
|
}
|
|
namespace threading {
|
|
|
|
std::thread make_thread_from_function(
|
|
std::string const &name,
|
|
std::function<void()> const &c,
|
|
config::ThreadGroupCfg const &cfg);
|
|
std::thread make_thread_from_function(
|
|
std::string const &name, std::function<void()> const &c);
|
|
|
|
template <class C>
|
|
std::thread make_thread(std::string const &name, C callable) {
|
|
return make_thread_from_function(name, std::function<void()>(callable));
|
|
}
|
|
|
|
template <class C>
|
|
std::thread make_thread(
|
|
std::string const &name, C callable, config::ThreadGroupCfg const &cfg) {
|
|
return make_thread_from_function(name, std::function<void()>(callable), cfg);
|
|
}
|
|
|
|
void configure_current_thread(std::string const &name);
|
|
void configure_current_thread(
|
|
std::string const &name, config::ThreadGroupCfg const &);
|
|
|
|
config::ThreadGroupCfg get_thread_cfg(std::string const &);
|
|
|
|
std::vector<uint32_t> get_affinity(std::string const &name);
|
|
|
|
} // namespace threading
|
|
} // namespace bts
|