]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/asio/test/signal_set.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / asio / test / signal_set.cpp
CommitLineData
7c673cae
FG
1//
2// signal_set.cpp
3// ~~~~~~~~~~~~~~
4//
b32b8144 5// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7c673cae
FG
6//
7// Distributed under the Boost Software License, Version 1.0. (See accompanying
8// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9//
10
11// Disable autolinking for unit tests.
12#if !defined(BOOST_ALL_NO_LIB)
13#define BOOST_ALL_NO_LIB 1
14#endif // !defined(BOOST_ALL_NO_LIB)
15
16// Test that header file is self-contained.
17#include <boost/asio/signal_set.hpp>
18
19#include "archetypes/async_result.hpp"
b32b8144 20#include <boost/asio/io_context.hpp>
7c673cae
FG
21#include "unit_test.hpp"
22
23//------------------------------------------------------------------------------
24
25// signal_set_compile test
26// ~~~~~~~~~~~~~~~~~~~~~~~
27// The following test checks that all public member functions on the class
28// signal_set compile and link correctly. Runtime failures are ignored.
29
30namespace signal_set_compile {
31
32void signal_handler(const boost::system::error_code&, int)
33{
34}
35
36void test()
37{
38 using namespace boost::asio;
39
40 try
41 {
b32b8144 42 io_context ioc;
7c673cae
FG
43 archetypes::lazy_handler lazy;
44 boost::system::error_code ec;
45
46 // basic_signal_set constructors.
47
b32b8144
FG
48 signal_set set1(ioc);
49 signal_set set2(ioc, 1);
50 signal_set set3(ioc, 1, 2);
51 signal_set set4(ioc, 1, 2, 3);
7c673cae
FG
52
53 // basic_io_object functions.
54
b32b8144
FG
55 signal_set::executor_type ex = set1.get_executor();
56 (void)ex;
57
58#if !defined(BOOST_ASIO_NO_DEPRECATED)
59 io_context& ioc_ref = set1.get_io_context();
60 (void)ioc_ref;
61
62 io_context& ioc_ref2 = set1.get_io_service();
63 (void)ioc_ref2;
64#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
7c673cae
FG
65
66 // basic_signal_set functions.
67
68 set1.add(1);
69 set1.add(1, ec);
70
71 set1.remove(1);
72 set1.remove(1, ec);
73
74 set1.clear();
75 set1.clear(ec);
76
77 set1.cancel();
78 set1.cancel(ec);
79
80 set1.async_wait(&signal_handler);
81 int i = set1.async_wait(lazy);
82 (void)i;
83 }
84 catch (std::exception&)
85 {
86 }
87}
88
89} // namespace signal_set_compile
90
91//------------------------------------------------------------------------------
92
93BOOST_ASIO_TEST_SUITE
94(
95 "signal_set",
96 BOOST_ASIO_TEST_CASE(signal_set_compile::test)
97)