Unravel Engine C++ Reference
Loading...
Searching...
No Matches
threader.cpp
Go to the documentation of this file.
1#include "threader.h"
2
4#include <logging/logging.h>
6namespace unravel
7{
9{
10 tpp::init_data data{};
11 data.set_thread_name = [](const std::string& name)
12 {
15 };
16
17 data.log_info = [](const std::string& msg)
18 {
19 APPLOG_INFO(msg);
20 };
21 data.log_error = [](const std::string& msg)
22 {
23 APPLOG_ERROR(msg);
24 };
25
26 tpp::init(data);
27
28 pool = std::make_unique<tpp::thread_pool>();
29}
30
31auto threader::init(rtti::context& ctx) -> bool
32{
33 APPLOG_TRACE("{}::{}", hpp::type_name_str(*this), __func__);
34
35 return true;
36}
37
39{
40 APPLOG_TRACE("{}::{}", hpp::type_name_str(*this), __func__);
41
42 if(pool)
43 {
44 pool.reset();
45 tpp::shutdown();
46 }
47
48 return true;
49}
50
52{
53 tpp::this_thread::process();
54}
55
56} // namespace unravel
std::string name
Definition hub.cpp:33
#define APPLOG_ERROR(...)
Definition logging.h:20
#define APPLOG_INFO(...)
Definition logging.h:18
#define APPLOG_TRACE(...)
Definition logging.h:17
void set_thread_name(const char *threadName)
Definition thread.hpp:160
auto get_thread_profile_data() -> thread_profile_data *
Definition profiler.h:410
auto init(rtti::context &ctx) -> bool
Definition threader.cpp:31
auto deinit(rtti::context &ctx) -> bool
Definition threader.cpp:38
std::unique_ptr< tpp::thread_pool > pool
Definition threader.h:22