6#include <userver/concurrent/async_event_channel.hpp>
7#include <userver/engine/task/task_processor_fwd.hpp>
8#include <userver/os_signals/subscriber.hpp>
9#include <userver/utils/impl/internal_tag.hpp>
11USERVER_NAMESPACE_BEGIN
15#if !defined(__APPLE__)
37class Processor
final {
39 explicit Processor(engine::TaskProcessor& task_processor);
43 template <
class Class>
44 Subscriber
AddListener(Class* obj, std::string_view name,
int signum,
void (Class::*func)()) {
45 auto execute = [obj, func, signum](
int sig) {
51 return channel_.AddListener(concurrent::FunctionId(obj), name, std::move(execute));
55 template <
class Class>
56 Subscriber
AddListener(Class* obj, std::string_view name,
void (Class::*func)(
int )) {
57 auto execute = [obj, func](
int sig) { (obj->*func)(sig); };
58 return channel_.AddListener(concurrent::FunctionId(obj), name, std::move(execute));
63 void Notify(
int signum,
utils::impl::InternalTag);
67 engine::TaskProcessor& task_processor_;