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>
5
6namespace unravel
7{
9{
10 tpp::init_data data{};
11 data.set_thread_name = [](const std::string& name)
12 {
14 };
15
16 data.log_info = [](const std::string& msg)
17 {
18 APPLOG_INFO(msg);
19 };
20 data.log_error = [](const std::string& msg)
21 {
22 APPLOG_ERROR(msg);
23 };
24
25 tpp::init(data);
26
27 pool = std::make_unique<tpp::thread_pool>();
28}
29
30auto threader::init(rtti::context& ctx) -> bool
31{
32 APPLOG_TRACE("{}::{}", hpp::type_name_str(*this), __func__);
33
34 return true;
35}
36
38{
39 APPLOG_TRACE("{}::{}", hpp::type_name_str(*this), __func__);
40
41 if(pool)
42 {
43 pool.reset();
44 tpp::shutdown();
45 }
46
47 return true;
48}
49
51{
52 tpp::this_thread::process();
53}
54
55} // namespace unravel
std::string name
Definition hub.cpp:27
#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:83
auto init(rtti::context &ctx) -> bool
Definition threader.cpp:30
auto deinit(rtti::context &ctx) -> bool
Definition threader.cpp:37
std::unique_ptr< tpp::thread_pool > pool
Definition threader.h:22