Files
suyu/externals/vcpkg/buildtrees/boost-asio/src/ost-1.79.0-dcbf3eae2c.clean/doc/requirements/CancellationHandler.qbk
Crimson-Hawk f1e4595ebf Initial commit
2024-03-05 16:42:40 +08:00

50 lines
1.0 KiB
Plaintext
Executable File

[/
/ Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
/
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
[section:CancellationHandler Cancellation handler requirements]
A value `h` of a cancellation handler class should work correctly in the
expression `h(t)`, where `t` is a value of type
`boost::asio::cancellation_type`.
[heading Examples]
A free function as a cancellation handler:
void cancellation_handler(
boost::asio::cancellation_type type)
{
...
}
slot.assign(cancellation_handler);
A cancellation handler function object:
struct cancellation_handler
{
...
void operator()(
boost::asio::cancellation_type type)
{
...
}
...
};
cancellation_handler& h = slot.assign(cancellation_handler{ ... });
A lambda as a cancellation handler:
auto& h = slot.assign(
[](boost::asio::cancellation_type type)
{
...
});
[endsect]