Commit Graph

2704 Commits

Author SHA1 Message Date
Christopher Kohlhoff
3582b06196 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-12 11:17:44 +10:00
Christopher Kohlhoff
0687857ec1 Specify memory ordering when reference counting with standard atomics. 2020-06-12 10:50:04 +10:00
Christopher Kohlhoff
716ab8d22c Add some gcc 9 targets on travis. 2020-06-08 11:55:05 +10:00
Christopher Kohlhoff
d6c41e33e3 Explicitly disable copy construction in io_context and thread_pool. 2020-06-08 11:54:35 +10:00
Christopher Kohlhoff
0d5dc52c81 Use alternate boost download location. 2020-06-08 10:49:04 +10:00
Christopher Kohlhoff
16695f2777 Add --with-boost=system option.
This configure option causes the build to define the necessary
preprocessor macros to use boost, but does not alter the include or
library paths.
2020-06-08 10:25:09 +10:00
Christopher Kohlhoff
67fc1fed38 Mark the asio_handler_allocate/deallocate hooks as deprecated.
Compiling an application with ASIO_NO_DEPRECATED will now trigger a
compile error if any handler implements the asio_handler_allocate or
asio_handler_deallocate hooks.
2020-06-07 12:13:20 +10:00
Christopher Kohlhoff
81964e87f4 Mark the asio_handler_invoke hook as deprecated.
Compiling an application with ASIO_NO_DEPRECATED will now trigger a
compile error if any handler implements the asio_handler_invoke hook.
2020-06-07 12:13:20 +10:00
Christopher Kohlhoff
8c4d117a41 Update socks4 example to use non-deprecated resolver interface. 2020-06-06 16:52:58 +10:00
Christopher Kohlhoff
73625e8e32 Another tutorial fix to reflect current resolver API. 2020-06-03 21:31:50 +10:00
Christopher Kohlhoff
cfa430c8de Fix examples in read_until() documentation. 2020-06-03 19:22:10 +10:00
Christopher Kohlhoff
91df1a56d3 Changes for clang-based Embarcadero C++ compilers. 2020-06-03 19:21:34 +10:00
Christopher Kohlhoff
62d0cf33a7 Add unit test for thread_pool. 2020-05-30 12:10:47 +10:00
Christopher Kohlhoff
8f48589ff1 Add missing .gitignore entry for io_context_strand. 2020-05-30 12:03:32 +10:00
Christopher Kohlhoff
c409c80105 Fix parameter names in co_spawn documentation. 2020-05-30 11:46:29 +10:00
Christopher Kohlhoff
c511ca8501 Remove spurious 'Executor' base class from executor_binder implementation.
This appears to have been left behind by an incomplete change made in
commit a1f71f95c4.
2020-05-30 11:40:59 +10:00
Christopher Kohlhoff
50e2c8c88e 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-05-30 11:40:59 +10:00
Christopher Kohlhoff
71324d7cbb Add as_default_on() and as_default_on_t<> to asio::detached_t. 2020-05-30 11:40:58 +10:00
Christopher Kohlhoff
2898a5e0fa 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-05-26 08:15:57 +10:00
Christopher Kohlhoff
3c63a53921 Add converting constructor to use_awaitable_t::executor_with_default. 2020-05-26 07:53:33 +10:00
Christopher Kohlhoff
bb39e3458f 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-05-25 15:42:30 +10:00
Christopher Kohlhoff
d40e5ba690 Add handlertree.pl tool.
The handlertree.pl script filters handler tracking output to include
only those events in the tree that produced the nominated handlers. For
example, to filter the output to include only the events associated with
handlers 123, 456, and their predecessors:

  cat output.txt | perl handlertree.pl 123 456

or:

  perl handlertree.pl 123 456 < output.txt

This script may be combined with handerlive.pl and handlerviz.pl to
produce a graph of the "live" asynchronous operation chains. For
example:

  cat output.txt | perl handlertree.pl `perl handlerlive.pl output.txt` | perl handlerviz.pl | dot -Tsvg > output.svg
2020-05-16 20:28:33 +10:00
Christopher Kohlhoff
7859c3acb9 Add handlerlive.pl tool.
The handlerlive.pl script processes handler tracking output to produce a
list of "live" handlers, namely those that are associated with pending
asynchronous operations, as well as handlers that are currently executing.

To use:

  cat output.txt | perl handlerlive.pl

or:

  perl handerlive.pl < output.txt

or:

  perl handlerlive.pl output.txt
2020-05-16 20:20:00 +10:00
Christopher Kohlhoff
0f7b5b8307 Various improvements to the handlerviz.pl tool.
* Add nodes for pending handlers at bottom of graph, outlined in red.
* Display source location in a tooltip on the edge label (for SVG).
* Use invisible nodes to enforce order to keep related control flow vertical.
2020-05-16 20:19:52 +10:00
Christopher Kohlhoff
c747142662 Add missing handler tracking include. 2020-05-15 08:57:44 +10:00
Christopher Kohlhoff
685aa84c2b Fix awaitable_handler specialisation for empty completion signatures. 2020-05-14 13:13:38 +10:00
Christopher Kohlhoff
74c19cdab6 Fix search/replace damage in comments. 2020-05-14 13:13:38 +10:00
Christopher Kohlhoff
11eed2fb3a Add source location support to handler tracking.
The 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-05-14 13:13:38 +10:00
Christopher Kohlhoff
c140c85091 Fix travis configuration warnings. 2020-05-08 19:34:57 +10:00
Christopher Kohlhoff
8cb3ec8609 Use more recent xcode on travis, add coroutines-enabled target. 2020-05-08 18:52:59 +10:00
Christopher Kohlhoff
a2397d7cc9 Add makefile support for coroutines. 2020-05-08 18:37:18 +10:00
Christopher Kohlhoff
2de6ec4c33 Enable C++20 coroutine support for gcc 10. 2020-05-08 12:39:36 +10:00
Christopher Kohlhoff
ebfaa50e3b Fix async_compose so that it works with copyable handlers passed as an lvalue. 2020-05-03 20:34:20 +10:00
Christopher Kohlhoff
658614dca6 Add move constructor to ssl::stream<>. 2020-05-03 20:22:32 +10:00
Christopher Kohlhoff
91d1264410 Add missing nested type '::type' when computing signature. 2020-05-03 18:55:45 +10:00
Christopher Kohlhoff
17637a48cc Linearise gather-write buffer sequences in ssl::stream. 2020-05-02 19:16:08 +10:00
Christopher Kohlhoff
a5c5077e44 asio version 1.16.1 released 2020-04-29 14:04:07 +10:00
Christopher Kohlhoff
3dafb7da40 Revision history. 2020-04-29 13:40:23 +10:00
Christopher Kohlhoff
4d4dcc901c Add Cirrus CI configuration to test FreeBSD. 2020-04-23 18:09:00 +10:00
Christopher Kohlhoff
5f23b9efbb Update tutorial text to use current resolver API. 2020-04-22 09:37:53 +10:00
Christopher Kohlhoff
f1ad6e81bb Fix incorrect overload selection due to injected class name. 2020-04-19 10:44:38 +10:00
Christopher Kohlhoff
cc7a4ac9c2 Replace '\n' with '[br]' in documentation. 2020-04-14 15:10:42 +10:00
Christopher Kohlhoff
2b7e4fe95a Update POSIX links. 2020-04-09 16:43:16 +10:00
Christopher Kohlhoff
28d563c7c3 Remove unused local variable. 2020-04-08 18:08:19 +10:00
Christopher Kohlhoff
a1336cd56f Use boost.bind placeholders from boost::placeholders namespace. 2020-04-08 18:04:00 +10:00
Christopher Kohlhoff
6ef3e9544e Call {shutdown,destroy} on priority_scheduler destruction in C++11 example. 2020-04-08 14:26:55 +10:00
Christopher Kohlhoff
c2cee7860f Fix use of rebind_executor in use_awaitable.as_default_on. 2020-04-08 14:26:55 +10:00
Christopher Kohlhoff
6f51579783 Regenerate documentation. 2020-04-07 11:48:25 +10:00
Christopher Kohlhoff
225b3feac1 Add link to C++14 examples section. 2020-04-07 11:43:19 +10:00
jmcruz-uma
074e6ff24d Fix comments with incorrect ASIO_HAS_TYPE_TRAITS to use ASIO_HAS_STD_TYPE_TRAITS. 2020-04-07 11:37:30 +10:00