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

928 Commits

Author SHA1 Message Date
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
Christopher Kohlhoff
0d0e36be72 Fix compile error on MSVC 2017. 2020-06-22 23:16:39 +10:00
Christopher Kohlhoff
7dad754997 Don't default the IoExecutor in detail::handler_work<>. 2020-06-22 23:16:39 +10:00
Christopher Kohlhoff
24bb388fb9 Change detail::completion_handler<> to use an I/O executor. 2020-06-22 23:16:39 +10:00
Christopher Kohlhoff
59d6542f2a Test for native I/O executors in detail::handler_work<>.
The detail::io_object_executor wrapper has been removed, and the job of
detecting, and optimising for, native I/O executors is now performed
directly in the detail::handler_work implementation.
2020-06-22 23:16:39 +10:00
Christopher Kohlhoff
deb0b72619 Change detail::handler_work<> to use an RAII-based approach. 2020-06-22 21:31:21 +10:00
Christopher Kohlhoff
3122e49c63 Avoid touching errors when we get a 0-length receive on a non-stream. 2020-06-22 21:30:58 +10:00
Christopher Kohlhoff
7f41b8ed6b Add single-buffer optimisation for descriptor read and write.
When we can determine at compile time that the user has supplied a
single buffer, use read/write rather than readv/writev, as the former
system calls can be faster.
2020-06-22 21:29:40 +10:00
Christopher Kohlhoff
bbe2dbe3e8 Add single-buffer optimisation for recvfrom and sendto.
When we can determine at compile time that the user has supplied a
single buffer, use recvfrom/sendto rather than recvmsg/sendmsg, as the
former system calls can be faster.
2020-06-22 21:29:07 +10:00
Christopher Kohlhoff
bab9d0fa72 Remove unnecessary allocator_ member. 2020-06-22 21:28:46 +10:00
Christopher Kohlhoff
bed41e4f4c On success, zero only the error_code value. 2020-06-22 21:28:15 +10:00
Christopher Kohlhoff
bd514b467f Use a cached success error code to avoid touching the category singleton. 2020-06-22 21:27:27 +10:00
Christopher Kohlhoff
b614b8d56c Return earlier on success in send/receive and read/write operations. 2020-06-22 21:26:58 +10:00
Christopher Kohlhoff
42b575ce2c Access errno only when on the error path. 2020-06-22 21:26:24 +10:00
Christopher Kohlhoff
e3ed5f0c68 Add single-buffer optimisation for send and receive.
When we can determine at compile time that the user has supplied a
single buffer, use send/recv rather than sendmsg/recvmsg, as the former
system calls can be faster.
2020-06-22 21:25:27 +10:00
Christopher Kohlhoff
bfe960d7fd Specify memory ordering when reference counting with standard atomics. 2020-06-22 21:24:58 +10:00
Christopher Kohlhoff
9d2c453770 Explicitly disable copy construction in io_context and thread_pool. 2020-06-22 21:21:59 +10:00
Christopher Kohlhoff
cb6b7e5f3c Mark the asio_handler_allocate/deallocate hooks as deprecated.
Compiling an application with BOOST_ASIO_NO_DEPRECATED will now trigger
a compile error if any handler implements the asio_handler_allocate or
asio_handler_deallocate hooks.
2020-06-22 21:00:02 +10:00
Christopher Kohlhoff
98b3e502b8 Mark the asio_handler_invoke hook as deprecated.
Compiling an application with BOOST_ASIO_NO_DEPRECATED will now trigger
a compile error if any handler implements the asio_handler_invoke hook.
2020-06-22 20:59:09 +10:00
Christopher Kohlhoff
92f9cd8967 Fix examples in read_until() documentation. 2020-06-22 20:58:16 +10:00
Christopher Kohlhoff
eb720ce904 Changes for clang-based Embarcadero C++ compilers. 2020-06-22 20:58:01 +10:00
Christopher Kohlhoff
38dabd1399 Fix parameter names in co_spawn documentation. 2020-06-22 20:51:22 +10:00
Christopher Kohlhoff
68b195d028 Remove spurious 'Executor' base class from executor_binder implementation. 2020-06-22 20:51:06 +10:00
Christopher Kohlhoff
7709723129 Correctly stop "own thread" in service destructor.
This change fixes the scheduler and win_iocp_io_context destructors so
that they correctly stop the internal thread that was created in the
constructor. This fixes a deadlock that can occur when two threads
concurrently attempt to create the first I/O object associated with a
non-native I/O execution context.
2020-06-22 20:50:53 +10:00
Christopher Kohlhoff
bab4f248b4 Add as_default_on() and as_default_on_t<> to asio::detached_t. 2020-06-22 20:50:27 +10:00
Christopher Kohlhoff
619cd04dbf Add converting move construction and assignment to basic_waitable_timer.
This change enables move construction and assignment between different timer
types, provided the executor types are convertible. For example:

  basic_waitable_timer<
      clock_type,
      traits_type,
      io_context::executor_type
    > timer1(my_io_context);

  basic_waitable_timer<
      clock_type,
      traits_type,
      executor // polymorphic wrapper
    > timer2(std::move(timer1));
2020-06-22 20:50:05 +10:00
Christopher Kohlhoff
e9f85a08e1 Add converting constructor to use_awaitable_t::executor_with_default. 2020-06-22 20:49:47 +10:00
Christopher Kohlhoff
3f12308c03 Add overloads of co_spawn that launch an awaitable.
This change allows us to write:

 co_spawn(executor,
     echo(std::move(socket)),
     detached);

instead of:

 co_spawn(executor,
     [socket = std::move(socket)]() mutable
     {
       return echo(std::move(socket));
     },
     detached);
2020-06-22 20:49:30 +10:00
Christopher Kohlhoff
b258d68f3a Add missing handler tracking include. 2020-06-22 20:47:48 +10:00
Christopher Kohlhoff
496fdf25a5 Fix awaitable_handler specialisation for empty completion signatures. 2020-06-22 20:47:32 +10:00
Christopher Kohlhoff
62afb04c4b Fix search/replace damage in comments. 2020-06-22 20:47:14 +10:00
Christopher Kohlhoff
cb60b08ff5 Add source location support to handler tracking.
The BOOST_ASIO_HANDLER_LOCATION((file_name, line, function_name)) macro
may be used to inform the handler tracking mechanism of a source
location. This macro declares an object that is placed on the stack.

When an asynchronous operation is launched with location information, it
outputs lines using the <action> 'n^m', prior to the 'n*m' line that
signifies the beginning of the asynchronous operation. For example:

    @asio|1589423304.861944|>7|ec=system:0,bytes_transferred=5
    @asio|1589423304.861952|7^8|in 'async_write' (./../../../include/asio/impl/write.hpp:330)
    @asio|1589423304.861952|7^8|called from 'do_write' (handler_tracking/async_tcp_echo_server.cpp:62)
    @asio|1589423304.861952|7^8|called from 'operator()' (handler_tracking/async_tcp_echo_server.cpp:51)
    @asio|1589423304.861952|7*8|socket@0x7ff61c008230.async_send
    @asio|1589423304.861975|.8|non_blocking_send,ec=system:0,bytes_transferred=5
    @asio|1589423304.861980|<7|

If std::source_location or std::experimental::source_location are
available, the use_awaitable_t token (when default-constructed or used
as a default completion token) will also cause handler tracking to
output a source location for each newly created asynchronous operation.
A use_awaitable_t object may also be explicitly constructed with location
information.
2020-06-22 20:46:29 +10:00
Christopher Kohlhoff
84ee50a2d8 Enable C++20 coroutine support for gcc 10. 2020-06-22 20:45:30 +10:00
Christopher Kohlhoff
4d3e0453e8 Fix async_compose so that it works with copyable handlers passed as an lvalue. 2020-06-22 20:45:09 +10:00
Christopher Kohlhoff
56aaf6156b Add move constructor to ssl::stream<>. 2020-06-22 20:42:56 +10:00
Christopher Kohlhoff
1cebe7c5b3 Add missing nested type '::type' when computing signature. 2020-06-22 20:40:13 +10:00
Christopher Kohlhoff
2f327be5fe Linearise gather-write buffer sequences in ssl::stream. 2020-06-22 20:37:47 +10:00
Christopher Kohlhoff
d114cff2d2 Version bump. 2020-04-22 21:55:36 +10:00
Christopher Kohlhoff
c7cf0ae0cf Fix incorrect overload selection due to injected class name. 2020-04-21 18:05:20 +10:00
Christopher Kohlhoff
371f4de392 Fix use of rebind_executor in use_awaitable.as_default_on. 2020-04-08 17:43:00 +10:00
Christopher Kohlhoff
cc5d523aee Fix comments with incorrect ASIO_HAS_TYPE_TRAITS to use ASIO_HAS_STD_TYPE_TRAITS. 2020-04-07 11:44:28 +10:00
Christopher Kohlhoff
34318996a2 Add emscripten compatibility patches (Use O_NONBLOCK instead of FIONBIO + Fix usage of strerror_r). 2020-04-07 11:44:28 +10:00
Christopher Kohlhoff
d3a0dc2d8b TV titles are also windows apps. 2020-04-07 11:44:28 +10:00
Christopher Kohlhoff
33412a42bb Remove unnecessary null pointer checks. 2020-04-07 11:44:28 +10:00
Christopher Kohlhoff
3654215317 Add ssl::context constructor to take ownership of a native handle. 2020-04-07 11:44:28 +10:00
Christopher Kohlhoff
c9382b9b42 Fix compile error in buffered streams due to lack of reference collapsing in C++98. 2020-04-07 11:44:28 +10:00
Christopher Kohlhoff
094aba17f4 Recreate the socket_select_interrupter's sockets on error.
On some versions of Windows, it seems that "self pipe trick" sockets may
be disconnected after a system sleep. To work around this, we recreate
the sockets following an error on read.
2020-04-07 11:44:28 +10:00