ThreadSchedule 3.0.0
Modern C++ thread management library
Loading...
Searching...
No Matches
registered_thread_backend.hpp
Go to the documentation of this file.
1#pragma once
2
8#include "../../thread_registry.hpp"
9#include "../thread_backend.hpp"
10#include <functional>
11#include <string>
12#include <type_traits>
13#include <utility>
14
15namespace threadschedule
16{
17
18namespace detail
19{
20
32{
33public:
35
37 auto operator=(registered_thread_backend&&) noexcept -> registered_thread_backend& = default;
38
40 auto operator=(registered_thread_backend const&) -> registered_thread_backend& = delete;
41
42 template <typename F, typename... Args>
43 explicit registered_thread_backend(std::string name, std::string component, F&& f, Args&&... args)
45 [n = std::move(name), c = std::move(component), func = std::forward<F>(f)](auto&&... inner) mutable
46 {
48 std::invoke(func, std::forward<decltype(inner)>(inner)...);
49 },
50 std::forward<Args>(args)...)
51 {
52 }
53};
54
55} // namespace detail
56
57} // namespace threadschedule
RAII registration of the calling thread in a portable registry.
thread_backend with automatic registration in the global thread_registry_backend.
registered_thread_backend(registered_thread_backend &&) noexcept=default
Owning wrapper around std::thread with RAII join-on-destroy semantics.