2
0
mirror of https://github.com/boostorg/asio.git synced 2026-01-30 19:32:09 +00:00
Commit Graph

974 Commits

Author SHA1 Message Date
Christopher Kohlhoff
36a811264d Add execution::executor_of concept and execution::is_executor trait. 2020-06-30 22:06:22 +10:00
Christopher Kohlhoff
4d8e791a8f Add execution::receiver concepts and traits.
This change adds the concepts:

  * execution::receiver
  * execution::receiver_of

and the trait:

  * execution::is_nothrow_receiver_of

It also adds the following traits that correspond to the concepts:

  * execution::is_receiver
  * execution::is_receiver_of
2020-06-30 22:02:21 +10:00
Christopher Kohlhoff
b68f15843c Add execution::set_value() customisation point object. 2020-06-30 21:55:37 +10:00
Christopher Kohlhoff
bd5acb1d51 Add execution::set_done() customisation point object. 2020-06-30 21:54:13 +10:00
Christopher Kohlhoff
3a22a4fb7b Add execution::set_error() customisation point object. 2020-06-30 21:52:51 +10:00
Christopher Kohlhoff
b51464b2ed Require gcc 4.8 or later to enable certain C++11 features.
When building with gcc, require version 4.8 or later to enable Asio's
support for the following C++11 features:

  * rvalue references and move support
  * variadic templates
  * constexpr
  * decltype
  * standard type traits
2020-06-30 21:50:08 +10:00
Christopher Kohlhoff
0689f316df Fix forward declaration guard used for any_executor. 2020-06-30 21:49:47 +10:00
Christopher Kohlhoff
45d52fb5ac Add standard executor support to basic_socket_acceptor accept() and async_accept(). 2020-06-26 15:46:15 +10:00
Christopher Kohlhoff
4ff016c025 More spawn() changes to support standard executors. 2020-06-26 15:45:55 +10:00
Christopher Kohlhoff
e6451028c3 Use a different target function table depending on the blocking property.
The any_executor class stores the state of the target's blocking
property to enable an optimisation in any_executor::execute(), i.e. if
the target executor has the property blocking.always, we can avoid a
memory allocation when type-erasing the submitted function object. With
this change the any_executor now "stores" the blocking property as a
different target function table, rather than as a separate member of
type blocking_t. This reduces the size of an any_executor by 8 bytes on
x86-64.
2020-06-26 15:44:47 +10:00
Christopher Kohlhoff
e2cde117c0 Add any_io_executor to forward declaration header 'netfwd.hpp'. 2020-06-24 20:07:00 +10:00
Christopher Kohlhoff
c06347a602 Documentation fix for the execution::allocator property. 2020-06-24 11:42:43 +10:00
Christopher Kohlhoff
242b3ee482 Disable executor_work_guard if BOOST_ASIO_NO_TS_EXECUTORS is defined. 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
bb547e1a44 Disable io_context::strand if BOOST_ASIO_NO_TS_EXECUTORS is defined. 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
307690de7f Disable asio::executor if BOOST_ASIO_NO_TS_EXECUTORS is defined. 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
fefe9a992e Use properties to track outstanding work against an io_context.
When using standard executors, work is tracked by requiring (or
preferring) an executor with the execution::outstanding_work.tracked
property. This replaces executor_work_guard and make_work_guard() with
code of the form

    asio::io_context io_context;
    auto work = asio::require(io_context.get_executor(),
        asio::execution::outstanding_work.tracked);

To explicitly reset work, store the returned work-tracking executor in
an any_io_executor object:

    asio::any_io_executor work
      = asio::require(io_context.get_executor(),
          asio::execution::outstanding_work.tracked);

and then assign an empty executor into the object when done:

    work = asio::any_io_executor();
2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
5488c28a3b Use an any_executor<> as the polymorphic executor for I/O objects.
The asio::any_io_executor type alias has been added as the default
runtime-polymorphic executor for all I/O objects. This type alias points
to the execution::any_executor<> template with a set of supportable
properties specified for use with I/O.

If required for backward compatibility, BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT
can be defined. This changes the asio::any_io_executor type alias to
point to the Networking TS-based runtime-polymorphic asio::executor
class instead.
2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
9557f87ae4 Increase emulated variadic template support to 8 parameters. 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
50ab1cb652 Add standard executor support to spawn. 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
166e773815 Add standard executor support to executor_work_guard. 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
34c898b27b Add standard executor support to use_future. 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
0d9bbf613c Add standard executor support to co_spawn. 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
e3d6bcfac9 Add standard executor support to async_compose. 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
20d2c5e806 Add standard executor support to bind_executor. 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
75c405d249 Add standard executor support to get_associated_executor. 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
3fc1f87a2b Add standard executor support to strand<>. 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
bbe07663c0 Add standard executor support to async I/O operations. 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
0e0a38df5f Add standard executor support to post(), dispatch(), and defer(). 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
95eb4eb16c Update system_executor to standard executor form. 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
d56b243026 io_context.hpp 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
121e8aa610 Update io_context::executor_type to standard executor form. 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
65dfb99273 threadpool 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
0a662cb309 Add static_thread_pool (as thread_pool in standard executor form). 2020-06-23 10:36:49 +10:00
Christopher Kohlhoff
9a743f078e Add "asio/execution.hpp" convenience header. 2020-06-23 10:36:49 +10:00
Christopher Kohlhoff
ac7e13f51b Add execution::context_as property adapter. 2020-06-23 10:36:49 +10:00
Christopher Kohlhoff
d2cb3bbdc6 Add execution::prefer_only property adapter. 2020-06-23 10:36:49 +10:00
Christopher Kohlhoff
3783cc1093 Add execution::any_executor. 2020-06-23 10:36:49 +10:00
Christopher Kohlhoff
ec2f491be0 Add execution::context property. 2020-06-22 23:16:39 +10:00
Christopher Kohlhoff
f1b382b32b Add execution::occupancy property. 2020-06-22 23:16:39 +10:00
Christopher Kohlhoff
f080c01965 Add execution::allocator property. 2020-06-22 23:16:39 +10:00
Christopher Kohlhoff
74a13e9920 Add execution::bulk_guarantee property. 2020-06-22 23:16:39 +10:00
Christopher Kohlhoff
3f90ca5cb2 Add execution::blocking_adaptation property. 2020-06-22 23:16:39 +10:00
Christopher Kohlhoff
bfeec7cd2b Add execution::relationship property. 2020-06-22 23:16:39 +10:00
Christopher Kohlhoff
3d5209fa19 Add execution::mapping property. 2020-06-22 23:16:39 +10:00
Christopher Kohlhoff
50e3e1798d Add execution::outstanding_work property. 2020-06-22 23:16:39 +10:00
Christopher Kohlhoff
36686f07a1 Add execution::blocking property. 2020-06-22 23:16:39 +10:00
Christopher Kohlhoff
834c5bdc8a Add execution::executor concept and execution::is_executor trait. 2020-06-22 23:16:39 +10:00
Christopher Kohlhoff
f6cfbc3982 Add execution::execute() customisation point object. 2020-06-22 23:16:39 +10:00
Christopher Kohlhoff
e3be5fe444 Add execution::invocable_archetype. 2020-06-22 23:16:39 +10:00
Christopher Kohlhoff
fac4056517 Add properties implementation. 2020-06-22 23:16:39 +10:00