userver: userver/os_signals/component.hpp Source File
Loading...
Searching...
No Matches
component.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/os_signals/component.hpp
4/// @brief @copybrief os_signals::ProcessorComponent
5
6#include <csignal>
7
8#include <userver/components/component_fwd.hpp>
9#include <userver/components/raw_component_base.hpp>
10#include <userver/os_signals/processor.hpp>
11
12USERVER_NAMESPACE_BEGIN
13
14/// @brief Components and functions to work with OS signals
15namespace os_signals {
16
17/// @ingroup userver_components
18///
19/// @brief A component for os_signals::Processor
20///
21/// Declaration in static config file may be skipped.
22///
23/// @see @ref scripts/docs/en/userver/os_signals.md
24class ProcessorComponent final : public components::RawComponentBase {
25public:
26 /// @ingroup userver_component_names
27 /// @brief The default name of os_signals::ProcessorComponent
28 static constexpr std::string_view kName = "os-signal-processor";
29
30 ProcessorComponent(const components::ComponentConfig& config, const components::ComponentContext& context);
31
32 os_signals::Processor& Get();
33
34private:
35 os_signals::Processor manager_;
36};
37
38} // namespace os_signals
39
40template <>
41inline constexpr auto components::kConfigFileMode<os_signals::ProcessorComponent> = ConfigFileMode::kNotRequired;
42
43USERVER_NAMESPACE_END