Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-17 08:39:20

0001 //
0002 // Copyright (c) 2025 Klemens Morgenstern (klemens.morgenstern@gmx.net)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 
0008 #ifndef BOOST_COBALT_IO_SIGNAL_SET_HPP
0009 #define BOOST_COBALT_IO_SIGNAL_SET_HPP
0010 
0011 #include <boost/cobalt/io/detail/config.hpp>
0012 #include <boost/cobalt/op.hpp>
0013 
0014 #include <boost/asio/basic_signal_set.hpp>
0015 #include <boost/system/result.hpp>
0016 
0017 #include <initializer_list>
0018 
0019 namespace boost::cobalt::io
0020 {
0021 
0022 struct BOOST_SYMBOL_VISIBLE signal_set
0023 {
0024   BOOST_COBALT_IO_DECL signal_set(const cobalt::executor & executor = this_thread::get_executor());
0025   BOOST_COBALT_IO_DECL signal_set(std::initializer_list<int> sigs, const cobalt::executor & executor = this_thread::get_executor());
0026 
0027   [[nodiscard]] BOOST_COBALT_IO_DECL system::result<void> cancel();
0028   [[nodiscard]] BOOST_COBALT_IO_DECL system::result<void> clear();
0029   [[nodiscard]] BOOST_COBALT_IO_DECL system::result<void> add(int signal_number);
0030   [[nodiscard]] BOOST_COBALT_IO_DECL system::result<void> remove(int signal_number);
0031 
0032 
0033  private:
0034   struct BOOST_COBALT_IO_DECL wait_op_ final : cobalt::op<system::error_code, int>
0035   {
0036     void initiate(completion_handler<system::error_code, int> h) final;
0037     wait_op_(asio::basic_signal_set<cobalt::executor> & signal_set) : signal_set_(signal_set) {}
0038     ~wait_op_() = default;
0039    private:
0040     asio::basic_signal_set<cobalt::executor> & signal_set_;
0041   };
0042  public:
0043   [[nodiscard]] auto wait() { return wait_op_{signal_set_}; }
0044  private:
0045   asio::basic_signal_set<cobalt::executor> signal_set_;
0046 };
0047 
0048 
0049 }
0050 
0051 #endif //BOOST_COBALT_IO_SIGNAL_SET_HPP