Files
spark/src/lib/utils/thread_manager.h
T

33 lines
1.0 KiB
C++

#pragma once
#include <string>
#include <thread>
#include <functional>
#include "lib/config/protos/threads.pb.h"
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);
}}