Commit Graph

2590 Commits

Author SHA1 Message Date
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
cynecx
607f99ba80 Add emscripten compatibility patches (Use O_NONBLOCK instead of FIONBIO + Fix usage of strerror_r). 2020-04-07 11:37:30 +10:00
Bas Zalmstra
46aa35f24a TV titles are also windows apps. 2020-04-07 11:37:30 +10:00
Christopher Kohlhoff
027a524907 Remove unnecessary null pointer checks. 2020-04-07 08:55:34 +10:00
Matvey Larionov
19d93672b0 Call {shutdown,destroy} on priority_scheduler destruction. 2020-04-07 08:42:05 +10:00
Christopher Kohlhoff
c0d28fc347 Add ssl::context constructor to take ownership of a native handle. 2020-04-07 08:35:02 +10:00
Christopher Kohlhoff
e6e2ff6957 Fix compile error in buffered streams due to lack of reference collapsing in C++98. 2020-04-07 08:29:53 +10:00
Christopher Kohlhoff
4b37bdbe3e 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 08:29:53 +10:00
Christopher Kohlhoff
63dcf4a980 Fix a Windows-specific thread_pool destructor hang when the pool has an associated I/O object. 2020-04-07 08:29:53 +10:00
Christopher Kohlhoff
d14f885ca6 Speed up documentation generation. 2020-04-07 08:29:53 +10:00
Christopher Kohlhoff
aedb783551 Suppress non-virtual destructor warnings. 2020-04-07 08:29:53 +10:00
Christopher Kohlhoff
023d36f2d3 Propagate non-EOF errors from add_certificate_authority. 2020-04-07 08:29:53 +10:00
Christopher Kohlhoff
9af8d57b2c Remove incorrect handler requirement checks in async_read that were accidentally left behind. 2020-04-07 08:29:53 +10:00
Christopher Kohlhoff
f44c34c635 Update overview to reflect that handlers are only required to be move constructible. 2020-04-07 08:29:53 +10:00
Christopher Kohlhoff
2602543e01 Add missing doxygen marker in executor_work_guard documentation. 2020-04-07 08:29:53 +10:00