Insane_DNS/libraries/asio-1.28.1/doc/asio/history.html

5434 lines
394 KiB
HTML
Raw Normal View History

2023-10-24 21:59:30 -04:00
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Revision History</title>
<link rel="stylesheet" href="../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../index.html" title="Asio">
<link rel="up" href="../index.html" title="Asio">
<link rel="prev" href="std_executors.html" title="Proposed Standard Executors">
<link rel="next" href="index.html" title="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../asio.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="std_executors.html"><img src="../prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../home.png" alt="Home"></a><a accesskey="n" href="index.html"><img src="../next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="asio.history"></a><a class="link" href="history.html" title="Revision History">Revision History</a>
</h2></div></div></div>
<h4>
<a name="asio.history.h0"></a>
<span><a name="asio.history.asio_1_28_1"></a></span><a class="link" href="history.html#asio.history.asio_1_28_1">Asio
1.28.1</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added missing compatibility with <code class="computeroutput"><span class="identifier">associated_immediate_executor</span></code>
to <code class="computeroutput"><span class="identifier">any_completion_handler</span></code>.
</li>
<li class="listitem">
Fixed a null pointer dereference that occurs when using <code class="computeroutput"><span class="identifier">query</span></code>,
<code class="computeroutput"><span class="identifier">require</span></code> or <code class="computeroutput"><span class="identifier">prefer</span></code> with an empty <code class="computeroutput"><span class="identifier">any_executor</span></code>.
</li>
<li class="listitem">
Added a workaround in <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">coro</span></code>
for a spurious syntax error when compiling with MSVC.
</li>
<li class="listitem">
Fixed an integer truncation issue in per-operation cancellation, when using
the reactor backend on 64-bit Windows.
</li>
<li class="listitem">
Added a compile-time check for a minimum Linux kernel version of 5.10,
when <code class="literal">io_uring</code> support is enabled.
</li>
<li class="listitem">
Fixed a compile error in the converting move constructors for <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">basic_channel</span></code> and <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">basic_concurrent_channel</span></code>.
</li>
<li class="listitem">
Fixed a memory leak on some <code class="computeroutput"><span class="identifier">signal_set</span></code>
error handling code paths.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">bad_address_cast</span></code>
to not use a deprecated implicit copy constructor.
</li>
<li class="listitem">
Fixed a copy/paste error in the <code class="computeroutput"><span class="identifier">dev_poll_reactor</span></code>
backend.
</li>
<li class="listitem">
Fixed the <code class="literal">io_uring</code> backend to ensure the internal timeout
operations, used to implement <code class="computeroutput"><span class="identifier">io_context</span><span class="special">::</span><span class="identifier">run_for</span></code>
and <code class="computeroutput"><span class="identifier">io_context</span><span class="special">::</span><span class="identifier">run_until</span></code>, are cleaned up correctly.
</li>
<li class="listitem">
Eliminated some duplicated state in the <code class="computeroutput"><span class="identifier">co_spawn</span></code>
implementation's entry point, reducing memory consumption.
</li>
<li class="listitem">
Added c++14 echo examples to boostify script.
</li>
</ul></div>
<h4>
<a name="asio.history.h1"></a>
<span><a name="asio.history.asio_1_28_0"></a></span><a class="link" href="history.html#asio.history.asio_1_28_0">Asio
1.28.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added missing handler tracking source location support to <code class="computeroutput"><span class="identifier">awaitable</span><span class="special">&lt;&gt;</span></code>-based
coroutine's ability to <code class="computeroutput"><span class="identifier">co_await</span></code>
asynchronous operations packaged as function objects.
</li>
<li class="listitem">
Add missing handler tracking source location support to <code class="computeroutput"><span class="identifier">co_composed</span></code>.
</li>
<li class="listitem">
Fixed suppression of spurious 'potential null dereference' warnings, to
work with older compilers.
</li>
<li class="listitem">
Fixed a bug where passing the deprecated <code class="computeroutput"><span class="identifier">const_buffers_1</span></code>
and <code class="computeroutput"><span class="identifier">mutable_buffers_1</span></code> types
to <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">()</span></code>
would result in the contiguous iterator overloads being incorrectly chosen.
</li>
<li class="listitem">
Disabled the runtime Windows version test unless targeting older Windows
versions.
</li>
<li class="listitem">
Fixed compatibility between buffered stream wrappers and move-constructible
streams, such as <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span><span class="special">&lt;&gt;</span></code>.
</li>
<li class="listitem">
Marked <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">address_v4</span><span class="special">::</span><span class="identifier">to_ulong</span></code> as deprecated in the documentation.
</li>
<li class="listitem">
Fixed shadowed variable warnings.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">basic_socket_acceptor</span><span class="special">::</span><span class="identifier">async_accept</span></code>
concept requirement checking to be compatible with lambdas that have a
deduced return type.
</li>
<li class="listitem">
Fixed a feature detection macro used in <code class="computeroutput"><span class="identifier">use_future</span></code>'s
compatibility traits.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">as_tuple</span></code> compatibility
with legacy completion tokens.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">redirect_error</span></code> compatibility
with new completion tokens.
</li>
<li class="listitem">
Fixed a potential, Windows-specific program termination due to exceptions
that should have been allowed to escape from a destructor.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">this_coro</span></code> to prevent
inadvertent <code class="computeroutput"><span class="identifier">co_await</span></code> of
boolean expressions.
</li>
<li class="listitem">
Fixed result handling in <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">use_coro</span></code>
implementation.
</li>
<li class="listitem">
Fixed variadic template emulation for <code class="computeroutput"><span class="identifier">is_async_operation</span></code>
and <code class="computeroutput"><span class="identifier">completion_signature_of</span></code>.
</li>
<li class="listitem">
Fixed incorrect reuse of a moved-from result in <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">promise</span></code>.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">coro</span></code> use with custom allocators.
</li>
<li class="listitem">
Fixed clean up of internal I/O object structures when using <code class="literal">io_uring</code>.
</li>
<li class="listitem">
Use cached offset when seeking a file with seek_cur on Windows.
</li>
<li class="listitem">
Added immediate completion to asynchronous operation requirements.
</li>
<li class="listitem">
Added <code class="computeroutput"><span class="identifier">any_completion_handler</span><span class="special">&lt;&gt;</span></code>, <code class="computeroutput"><span class="identifier">co_composed</span></code>,
and immediate completion support to the documentation overview.
</li>
<li class="listitem">
Added buffer literals to the documentation.
</li>
<li class="listitem">
Added a link to the <a href="https://github.com/chriskohlhoff/asio-debugger-extensions" target="_top">Asio
debugger extensions</a> repository.
</li>
</ul></div>
<h4>
<a name="asio.history.h2"></a>
<span><a name="asio.history.asio_1_27_0"></a></span><a class="link" href="history.html#asio.history.asio_1_27_0">Asio
1.27.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<p class="simpara">
Added the ability to customise the execution of a completion handler when
an operation completes immediately. This change adds the <code class="computeroutput"><span class="identifier">associated_immediate_executor</span></code> associator
trait, <code class="computeroutput"><span class="identifier">bind_immediate_executor</span></code>
function, and <code class="computeroutput"><span class="identifier">immediate_executor_binder</span></code>
adapter. When a supported operation completes immediately (that is, within
the initiating function) the associated immmediate executor is obtained,
and the completion handler is delivered through that executor as if by
using <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">dispatch</span></code> on that executor. By default,
the immediate executor delivers the completion handler as if using <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">post</span></code> via the operation's I/O executor.
For example, to allow a recursive call to the completion handler of an
<code class="computeroutput"><span class="identifier">async_read_some</span></code> operation,
we may specify that immediate completion is delivered via a <code class="computeroutput"><span class="identifier">system_executor</span></code>:<br>
</p>
<pre class="programlisting"><span class="identifier">my_socket</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">my_buffer</span><span class="special">,</span>
<span class="identifier">bind_immediate_executor</span><span class="special">(</span>
<span class="identifier">system_executor</span><span class="special">(),</span>
<span class="special">[](</span><span class="identifier">error_code</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">n</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="special">}</span>
<span class="special">)</span>
<span class="special">);</span>
</pre>
<p class="simpara">
<br> Immediate execution is currently supported for asynchronous operations
on reactor-based sockets and descriptors, and for asynchronous operations
on channels.
</p>
</li>
<li class="listitem">
<p class="simpara">
Added user-defined literals for buffer types. The <code class="computeroutput"><span class="identifier">_buf</span></code>
literal suffix, defined in namespace <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer_literals</span></code>,
may be used to create const_buffer objects from string, binary integer,
and hexadecimal integer literals. These buffer literals may be arbitrarily
long. For example:<br>
</p>
<pre class="programlisting"> using namespace asio::buffer_literals;
asio::const_buffer b1 = "hello"_buf;
asio::const_buffer b2 = 0xdeadbeef_buf;
asio::const_buffer b3 = 0x01234567'89abcdef'01234567'89abcdef_buf;
asio::const_buffer b4 = 0b1010101011001100_buf;
</pre>
<p class="simpara">
<br> The memory associated with a buffer literal is valid for the lifetime
of the program. This means that the buffer can be safely used with asynchronous
operations:<br>
</p>
<pre class="programlisting"><span class="identifier">async_write</span><span class="special">(</span><span class="identifier">my_socket</span><span class="special">,</span> <span class="string">"hello"</span><span class="identifier">_buf</span><span class="special">,</span> <span class="identifier">my_handler</span><span class="special">);</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
Added a new protocol type <code class="computeroutput"><span class="identifier">local</span><span class="special">::</span><span class="identifier">seq_packet_protocol</span></code>
to represent <code class="computeroutput"><span class="identifier">AF_UNIX</span></code> with
<code class="computeroutput"><span class="identifier">SOCK_SEQPACKET</span></code>.
</li>
<li class="listitem">
<p class="simpara">
Exposed <code class="computeroutput"><span class="identifier">sigaction</span><span class="special">()</span></code>
flags via optional argument to <code class="computeroutput"><span class="identifier">signal_set</span><span class="special">::</span><span class="identifier">add</span></code>.
When registering a signal, it is now possible to pass flags that specify
the behaviour associated with the signal. These flags are specified as
an enum type in a new class, signal_set_base, and are passed to the underlying
<code class="computeroutput"><span class="identifier">sigaction</span><span class="special">()</span></code>
call. For example:<br>
</p>
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">signal_set</span> <span class="identifier">sigs</span><span class="special">(</span><span class="identifier">my_io_context</span><span class="special">);</span>
<span class="identifier">sigs</span><span class="special">.</span><span class="identifier">add</span><span class="special">(</span><span class="identifier">SIGINT</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">signal_set</span><span class="special">::</span><span class="identifier">flags</span><span class="special">::</span><span class="identifier">restart</span><span class="special">);</span>
</pre>
<p class="simpara">
<br> Specifying flags other than <code class="computeroutput"><span class="identifier">flags</span><span class="special">::</span><span class="identifier">dont_care</span></code>
will fail unless <code class="computeroutput"><span class="identifier">sigaction</span><span class="special">()</span></code> is supported by the target operating
system. Since signal registration is global, conflicting flags (multiple
registrations that pass differing flags other than <code class="computeroutput"><span class="identifier">flags</span><span class="special">::</span><span class="identifier">dont_care</span></code>)
will also result in an error.
</p>
</li>
<li class="listitem">
Change <code class="computeroutput"><span class="identifier">allocator_binder</span></code>,
<code class="computeroutput"><span class="identifier">executor_binder</span></code>, and <code class="computeroutput"><span class="identifier">cancellation_slot_binder</span></code> to support detection
of unspecialised associators.
</li>
<li class="listitem">
Fixed ambiguity in <code class="computeroutput"><span class="identifier">associated_cancellation_slot</span><span class="special">&lt;</span><span class="identifier">reference_wrapper</span><span class="special">&gt;::</span><span class="identifier">get</span><span class="special">()</span></code>.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">awaitable</span></code> handling
for completion signatures containing <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">exception_ptr</span></code>.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">channel</span></code> <code class="computeroutput"><span class="identifier">try_send</span></code>
failure after a <code class="computeroutput"><span class="identifier">cancel</span></code>.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">thread_pool</span><span class="special">::</span><span class="identifier">join</span><span class="special">()</span></code>
deadlock when the pool has no internal threads.
</li>
<li class="listitem">
Fixed pipe <code class="computeroutput"><span class="identifier">release</span><span class="special">()</span></code>
when using <code class="literal">io_uring</code>.
</li>
<li class="listitem">
Fixed a data initialisation issue in the <code class="literal">io_uring</code> backend.
</li>
<li class="listitem">
Fixed a dangling reference issue in the execution context overload of
<code class="computeroutput"><span class="identifier">get_associated_executor</span></code>.
</li>
<li class="listitem">
Ensured buffered messages can still be received when an <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">channel</span></code>
is closed.
</li>
<li class="listitem">
Fixed the <code class="computeroutput"><span class="identifier">any_completion_handler</span></code>
assignment operator to work correctly.
</li>
<li class="listitem">
Constrained the constructor of the move-only class template <code class="computeroutput"><span class="identifier">any_completion_handler</span></code> to prevent accidental
copying
</li>
<li class="listitem">
Suppressed spurious 'potential null dereference' warnings.
</li>
<li class="listitem">
Changed to use <code class="computeroutput"><span class="identifier">uint64_t</span></code>
for OpenSSL options, to match OpenSSL 3.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">deferred</span></code> interoperability
with multiple completion signatures.
</li>
<li class="listitem">
Fixed channels to support C++11 and later. Note that for C++11 and C++14,
support is limited to channels with a single completion signature, or channels
with a void() signature (plus the error signature added by the channel
traits).
</li>
<li class="listitem">
Added <code class="computeroutput"><span class="identifier">any_completion_handler</span></code>
to the documentation.
</li>
</ul></div>
<h4>
<a name="asio.history.h3"></a>
<span><a name="asio.history.asio_1_26_0"></a></span><a class="link" href="history.html#asio.history.asio_1_26_0">Asio
1.26.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">spawn</span></code> and <code class="computeroutput"><span class="identifier">co_spawn</span></code> implementations to dispatch
cancellation handlers on the correct executor. When a completion handler
uses a specified (i.e. non-default) associated executor, cancellation handlers
are dispatched to the executor that was passed to <code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">co_spawn</span><span class="special">()</span></code>.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">spawn</span></code> to ensure the
completion handler is dispatched through the correct executor.
</li>
<li class="listitem">
Changed to use <code class="computeroutput"><span class="identifier">snprintf</span></code>
rather than <code class="computeroutput"><span class="identifier">sprintf</span></code> on
latest Xcode, to address deprecation warnings.
</li>
<li class="listitem">
Fixed compatibility between <code class="computeroutput"><span class="identifier">co_spawn</span></code>
and <code class="computeroutput"><span class="identifier">any_completion_handler</span></code>.
</li>
<li class="listitem">
Fixed the arguments passed to <code class="computeroutput"><span class="identifier">select_reactor</span><span class="special">::</span><span class="identifier">run</span></code>
when it is run on an internal thread.
</li>
<li class="listitem">
Fixed compilation errors when <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_DISABLE_SMALL_BLOCK_RECYCLING</span></code> is
defined.
</li>
<li class="listitem">
Updated detection of C++20 coroutine support on clang 14 and later. This
includes the ability to use coroutines with libstdc++.
</li>
<li class="listitem">
Changed standard library feature detection to always enable <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invoke_result</span></code> when targeting C++17 or
later.
</li>
<li class="listitem">
Fixed detection of return type deduction with MSVC.
</li>
<li class="listitem">
Added a missing include in <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">coro</span></code>
implementation.
</li>
<li class="listitem">
Updated the asynchronous operation requirements to relax the requirements
on the associated executor.
</li>
<li class="listitem">
Added <code class="literal">io_uring</code> to the implementation notes.
</li>
</ul></div>
<h4>
<a name="asio.history.h4"></a>
<span><a name="asio.history.asio_1_25_0"></a></span><a class="link" href="history.html#asio.history.asio_1_25_0">Asio
1.25.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<p class="simpara">
Added the <code class="computeroutput"><span class="identifier">consign</span></code> completion
token adapter, which can be used to attach additional values to a completion
handler. This is typically used to keep at least one copy of an object,
such as a smart pointer, alive until the completion handler is called.
For example:<br>
</p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="identifier">timer1</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_shared</span><span class="special">&lt;</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">steady_timer</span><span class="special">&gt;(</span><span class="identifier">my_io_context</span><span class="special">);</span>
<span class="identifier">timer1</span><span class="special">-&gt;</span><span class="identifier">expires_after</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">seconds</span><span class="special">(</span><span class="number">1</span><span class="special">));</span>
<span class="identifier">timer1</span><span class="special">-&gt;</span><span class="identifier">async_wait</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">consign</span><span class="special">(</span>
<span class="special">[](</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="special">},</span>
<span class="identifier">timer1</span>
<span class="special">)</span>
<span class="special">);</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
<p class="simpara">
Added <code class="computeroutput"><span class="identifier">any_completion_handler</span><span class="special">&lt;&gt;</span></code>, which can be used to type-erase
completion handlers. A typical use case is to enable separate compilation
of asynchronous operation implementations. For example:<br>
</p>
<pre class="programlisting"><span class="comment">// Header file:</span>
<span class="keyword">void</span> <span class="identifier">async_sleep_impl</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">any_completion_handler</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">)&gt;</span> <span class="identifier">handler</span><span class="special">,</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">any_io_executor</span> <span class="identifier">ex</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">nanoseconds</span> <span class="identifier">duration</span><span class="special">);</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">CompletionToken</span><span class="special">&gt;</span>
<span class="keyword">inline</span> <span class="keyword">auto</span> <span class="identifier">async_sleep</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">any_io_executor</span> <span class="identifier">ex</span><span class="special">,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">nanoseconds</span> <span class="identifier">duration</span><span class="special">,</span> <span class="identifier">CompletionToken</span><span class="special">&amp;&amp;</span> <span class="identifier">token</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">async_initiate</span><span class="special">&lt;</span>
<span class="identifier">CompletionToken</span><span class="special">,</span> <span class="keyword">void</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">)&gt;(</span>
<span class="identifier">async_sleep_impl</span><span class="special">,</span> <span class="identifier">token</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">ex</span><span class="special">),</span> <span class="identifier">duration</span><span class="special">);</span>
<span class="special">}</span>
<span class="comment">// Separately compiled source file:</span>
<span class="keyword">void</span> <span class="identifier">async_sleep_impl</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">any_completion_handler</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">)&gt;</span> <span class="identifier">handler</span><span class="special">,</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">any_io_executor</span> <span class="identifier">ex</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">nanoseconds</span> <span class="identifier">duration</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">auto</span> <span class="identifier">timer</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_shared</span><span class="special">&lt;</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">steady_timer</span><span class="special">&gt;(</span><span class="identifier">ex</span><span class="special">,</span> <span class="identifier">duration</span><span class="special">);</span>
<span class="identifier">timer</span><span class="special">-&gt;</span><span class="identifier">async_wait</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">consign</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">handler</span><span class="special">),</span> <span class="identifier">timer</span><span class="special">));</span>
<span class="special">}</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
<p class="simpara">
Added <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">co_composed</span></code> which facilitates a lightweight
implementation of user-defined asynchronous operations using C++20 coroutines.
The following example illustrates a simple asynchronous operation that
implements an echo protocol in terms of a coroutine:<br>
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">CompletionToken</span><span class="special">&gt;</span>
<span class="keyword">auto</span> <span class="identifier">async_echo</span><span class="special">(</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">&amp;</span> <span class="identifier">socket</span><span class="special">,</span>
<span class="identifier">CompletionToken</span><span class="special">&amp;&amp;</span> <span class="identifier">token</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">async_initiate</span><span class="special">&lt;</span>
<span class="identifier">CompletionToken</span><span class="special">,</span> <span class="keyword">void</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">)&gt;(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">co_composed</span><span class="special">&lt;</span>
<span class="keyword">void</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">)&gt;(</span>
<span class="special">[](</span><span class="keyword">auto</span> <span class="identifier">state</span><span class="special">,</span> <span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">&amp;</span> <span class="identifier">socket</span><span class="special">)</span> <span class="special">-&gt;</span> <span class="keyword">void</span>
<span class="special">{</span>
<span class="keyword">try</span>
<span class="special">{</span>
<span class="identifier">state</span><span class="special">.</span><span class="identifier">throw_if_cancelled</span><span class="special">(</span><span class="keyword">true</span><span class="special">);</span>
<span class="identifier">state</span><span class="special">.</span><span class="identifier">reset_cancellation_state</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">enable_terminal_cancellation</span><span class="special">());</span>
<span class="keyword">for</span> <span class="special">(;;)</span>
<span class="special">{</span>
<span class="keyword">char</span> <span class="identifier">data</span><span class="special">[</span><span class="number">1024</span><span class="special">];</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">n</span> <span class="special">=</span> <span class="identifier">co_await</span> <span class="identifier">socket</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">data</span><span class="special">),</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">deferred</span><span class="special">);</span>
<span class="identifier">co_await</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">async_write</span><span class="special">(</span><span class="identifier">socket</span><span class="special">,</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">data</span><span class="special">,</span> <span class="identifier">n</span><span class="special">),</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">deferred</span><span class="special">);</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="keyword">catch</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">system_error</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">co_return</span> <span class="special">{</span><span class="identifier">e</span><span class="special">.</span><span class="identifier">code</span><span class="special">()};</span>
<span class="special">}</span>
<span class="special">},</span> <span class="identifier">socket</span><span class="special">),</span>
<span class="identifier">token</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">socket</span><span class="special">));</span>
<span class="special">}</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
<p class="simpara">
Add range-based experimental::make_parallel_group() overloads that may
be used to launch a dynamically-sized set of asynchronous operations, where
all operations are the same type. For example:<br>
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">op_type</span> <span class="special">=</span> <span class="keyword">decltype</span><span class="special">(</span>
<span class="identifier">socket1</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">data1</span><span class="special">),</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">deferred</span>
<span class="special">)</span>
<span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">op_type</span><span class="special">&gt;</span> <span class="identifier">ops</span><span class="special">;</span>
<span class="identifier">ops</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span>
<span class="identifier">socket1</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">data1</span><span class="special">),</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">deferred</span>
<span class="special">)</span>
<span class="special">);</span>
<span class="identifier">ops</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span>
<span class="identifier">socket2</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">data2</span><span class="special">),</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">deferred</span>
<span class="special">)</span>
<span class="special">);</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">make_parallel_group</span><span class="special">(</span><span class="identifier">ops</span><span class="special">).</span><span class="identifier">async_wait</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">wait_for_all</span><span class="special">(),</span>
<span class="special">[](</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">&gt;</span> <span class="identifier">completion_order</span><span class="special">,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&gt;</span> <span class="identifier">e</span><span class="special">,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">&gt;</span> <span class="identifier">n</span>
<span class="special">)</span>
<span class="special">{</span>
<span class="keyword">for</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">&lt;</span> <span class="identifier">completion_order</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">idx</span> <span class="special">=</span> <span class="identifier">completion_order</span><span class="special">[</span><span class="identifier">i</span><span class="special">];</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"socket "</span> <span class="special">&lt;&lt;</span> <span class="identifier">idx</span> <span class="special">&lt;&lt;</span> <span class="string">" finished: "</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">e</span><span class="special">[</span><span class="identifier">idx</span><span class="special">]</span> <span class="special">&lt;&lt;</span> <span class="string">", "</span> <span class="special">&lt;&lt;</span> <span class="identifier">n</span><span class="special">[</span><span class="identifier">idx</span><span class="special">]</span> <span class="special">&lt;&lt;</span> <span class="string">"\n"</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="special">);</span>
</pre>
<p class="simpara">
<br> Thanks go to Klemens Morgenstern for supplying part of this implementation.
</p>
</li>
<li class="listitem">
Added <code class="computeroutput"><span class="identifier">any_completion_executor</span></code>,
a type-erased wrappers for executors that are associated with completion
handlers.
</li>
<li class="listitem">
Added missing <code class="computeroutput"><span class="identifier">context</span></code> query
to use_future's executor.
</li>
<li class="listitem">
Added nothrow constructor overloads to <code class="computeroutput"><span class="identifier">execution</span><span class="special">::</span><span class="identifier">any_executor</span><span class="special">&lt;&gt;</span></code> and <code class="computeroutput"><span class="identifier">any_io_executor</span></code>.
</li>
<li class="listitem">
Optimised representation of empty <code class="computeroutput"><span class="identifier">execution</span><span class="special">::</span><span class="identifier">any_executor</span></code>
objects to improve the performance of copy and move operations.
</li>
<li class="listitem">
Added an <code class="computeroutput"><span class="identifier">associated_cancellation_slot</span></code>
specialisation for <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">reference_wrapper</span></code>.
</li>
<li class="listitem">
Changed I/O objects to return their executors by const reference.
</li>
<li class="listitem">
Changed associated to use deduced return types for all two-argument <code class="computeroutput"><span class="identifier">get</span></code> functions.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">spawn</span></code> implementation
to catch unhandled exceptions and rethrow them outside of the spawned "thread".
</li>
<li class="listitem">
Fixed cleanup of of terminal-state <code class="computeroutput"><span class="identifier">spawn</span></code>
"thread" objects.
</li>
<li class="listitem">
Changed semantics of <code class="computeroutput"><span class="identifier">dispatch</span></code>
to mean the executor is used as-is. An execution context's default executor
is imbued with the possibly-blocking property.
</li>
<li class="listitem">
Deprecated the <code class="computeroutput"><span class="identifier">execution</span><span class="special">::</span><span class="identifier">execute</span></code>
customisation point. Use <code class="computeroutput"><span class="identifier">execute</span></code>
as a member function.
</li>
<li class="listitem">
Deprecated the concepts, traits, functions and customisation points related
to senders and receivers.
</li>
<li class="listitem">
Added a C++11 <code class="computeroutput"><span class="identifier">parallel_group</span></code>
example.
</li>
<li class="listitem">
Fixed example code to not use the deprecated conversion of a resolve result
to an endpoint.
</li>
<li class="listitem">
Fixed an ambiguity in <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">channel_traits</span></code>
specialisations.
</li>
<li class="listitem">
Added a specialised channel implementation for the for <code class="computeroutput"><span class="identifier">R</span><span class="special">(</span><span class="identifier">error_code</span><span class="special">)</span></code> signature.
</li>
<li class="listitem">
Made <code class="computeroutput"><span class="identifier">cancelled</span><span class="special">()</span></code>
public on the <code class="computeroutput"><span class="identifier">async_compose</span></code>
'self' object.
</li>
<li class="listitem">
Added io_executor_type and get_io_executor to the <code class="computeroutput"><span class="identifier">async_compose</span></code>
'self' object.
</li>
<li class="listitem">
Fixed implementation of <code class="computeroutput"><span class="identifier">release</span><span class="special">()</span></code> for Windows overlapped handles.
</li>
<li class="listitem">
Enabled deferred awaiting for <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">coro</span></code>,
regularised <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">use_coro</span></code>,
and fixed allocator handling. This means that <code class="computeroutput"><span class="identifier">use_coro</span></code>
does not return a coro object, just like use_awaitable does, i.e. it's
an overhead that buys us type erasure. Allocators can now be set for <code class="computeroutput"><span class="identifier">coro</span></code> by including <code class="computeroutput"><span class="identifier">allocator_arg</span></code>
in the coro signature.
</li>
<li class="listitem">
Cleaned up <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">promise</span></code>
and made it an asynchronous operation object.
</li>
<li class="listitem">
Constrained <code class="computeroutput"><span class="identifier">post</span></code>/<code class="computeroutput"><span class="identifier">defer</span></code> overloads on ability to require
<code class="computeroutput"><span class="identifier">blocking</span><span class="special">.</span><span class="identifier">never</span></code>.
</li>
<li class="listitem">
Changed descriptor implementation to fall back to <code class="computeroutput"><span class="identifier">fcntl</span></code>
if <code class="computeroutput"><span class="identifier">ioctl</span></code> fails with <code class="computeroutput"><span class="identifier">ENOTTY</span></code> when setting non-blocking mode.
</li>
</ul></div>
<h4>
<a name="asio.history.h5"></a>
<span><a name="asio.history.asio_1_24_0"></a></span><a class="link" href="history.html#asio.history.asio_1_24_0">Asio
1.24.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Improved the performance of <code class="computeroutput"><span class="identifier">awaitable</span><span class="special">&lt;&gt;</span></code>-based coroutines when they directly
<code class="computeroutput"><span class="identifier">co_await</span></code> an asynchronous
operation, by eliminating the copy of the operation object in <code class="computeroutput"><span class="identifier">await_transform</span></code>.
</li>
<li class="listitem">
Improved the performance of <code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code>-based stackful coroutines by storing
a reference to the yield context in the completion handler, rather than
storing a copy of the executor.
</li>
<li class="listitem">
Fixed a C++03 build error by disabling <code class="computeroutput"><span class="identifier">index_sequence</span></code>
emulation when variadic templates are unavailable.
</li>
<li class="listitem">
Fixed detection of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">aligned_alloc</span></code>
for older Apple platforms.
</li>
<li class="listitem">
Removed faulty assertions from <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">coro</span></code>
implementation.
</li>
<li class="listitem">
Added defence against Qt-defined macros when building with Intel C++.
</li>
<li class="listitem">
Ensured that a <code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code>-based
stackful coroutine is cleaned up immediately after it completes.
</li>
<li class="listitem">
Changed the implementation of the <code class="computeroutput"><span class="identifier">select_reactor</span></code>,
on Windows, to ensure that any exception resulting from failure to recreate
its interrupter's sockets will be allowed to propagate out through <code class="computeroutput"><span class="identifier">io_context</span><span class="special">::</span><span class="identifier">run</span><span class="special">()</span></code>.
</li>
<li class="listitem">
Changed the MSVC version used for the <code class="computeroutput"><span class="identifier">system_error</span></code>
workaround, as more recent runtime redistributables appear to have fixed
the issue.
</li>
<li class="listitem">
Changed the <code class="computeroutput"><span class="identifier">async_compose</span></code>
example to use a return type compatible with the new <code class="computeroutput"><span class="identifier">async_result</span></code>
form.
</li>
</ul></div>
<h4>
<a name="asio.history.h6"></a>
<span><a name="asio.history.asio_1_23_0"></a></span><a class="link" href="history.html#asio.history.asio_1_23_0">Asio
1.23.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added a deduced trailing return type, using <code class="computeroutput"><span class="keyword">decltype</span></code>,
to all asynchronous operations' initiating functions when using C++11.
This change enables the new form of <code class="computeroutput"><span class="identifier">async_result</span></code>,
where the return type can vary per operation, for C++11.
</li>
<li class="listitem">
Moved <code class="computeroutput"><span class="identifier">append</span></code>, <code class="computeroutput"><span class="identifier">prepend</span></code>, <code class="computeroutput"><span class="identifier">as_tuple</span></code>,
and <code class="computeroutput"><span class="identifier">deferred</span></code> to the <code class="computeroutput"><span class="identifier">asio</span></code> namespace, and made them compatible
with C++11. These are no longer experimental facilities, although the names
have temporarily been retained under the <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span></code>
namespace for backwards compatibility.
</li>
<li class="listitem">
Added <code class="computeroutput"><span class="identifier">buffer</span><span class="special">()</span></code>
overloads for contiguous containers, such as <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">span</span></code>.
</li>
<li class="listitem">
<p class="simpara">
Added the ability for <code class="computeroutput"><span class="identifier">awaitable</span><span class="special">&lt;&gt;</span></code>-based coroutines to directly <code class="computeroutput"><span class="identifier">co_await</span></code> operations that are packaged
as function objects. For example, using <code class="computeroutput"><span class="identifier">deferred</span></code>:<br>
</p>
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">awaitable</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">&gt;</span> <span class="identifier">my_coro</span><span class="special">()</span>
<span class="special">{</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">steady_timer</span> <span class="identifier">timer</span><span class="special">(</span><span class="identifier">co_await</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">this_coro</span><span class="special">::</span><span class="identifier">executor</span><span class="special">);</span>
<span class="identifier">timer</span><span class="special">.</span><span class="identifier">expires_after</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">seconds</span><span class="special">(</span><span class="number">5</span><span class="special">));</span>
<span class="identifier">co_await</span> <span class="identifier">timer</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">deferred</span><span class="special">);</span>
<span class="special">}</span>
</pre>
<p class="simpara">
or with a handcrafted function object:<br>
</p>
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">awaitable</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">&gt;</span> <span class="identifier">my_coro</span><span class="special">()</span>
<span class="special">{</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">steady_timer</span> <span class="identifier">timer</span><span class="special">(</span><span class="identifier">co_await</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">this_coro</span><span class="special">::</span><span class="identifier">executor</span><span class="special">);</span>
<span class="identifier">timer</span><span class="special">.</span><span class="identifier">expires_after</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">seconds</span><span class="special">(</span><span class="number">5</span><span class="special">));</span>
<span class="identifier">co_await</span> <span class="special">[&amp;](</span><span class="keyword">auto</span><span class="special">&amp;&amp;</span> <span class="identifier">token</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">timer</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">forward</span><span class="special">&lt;</span><span class="keyword">decltype</span><span class="special">(</span><span class="identifier">token</span><span class="special">)&gt;(</span><span class="identifier">token</span><span class="special">));</span>
<span class="special">};</span>
<span class="special">}</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
<p class="simpara">
Changed <code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code>
to be a completion token-based asynchronous operation. This introduces
new <code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code>
overloads that conform to the requirements for asynchronous operations.
For example:<br>
</p>
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">do_read</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">yield_context</span> <span class="identifier">yield</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">char</span> <span class="identifier">data</span><span class="special">[</span><span class="number">1024</span><span class="special">];</span>
<span class="identifier">size_t</span> <span class="identifier">n</span> <span class="special">=</span> <span class="identifier">my_socket</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">data</span><span class="special">),</span> <span class="identifier">yield</span><span class="special">);</span>
<span class="keyword">return</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(</span><span class="identifier">data</span><span class="special">,</span> <span class="identifier">n</span><span class="special">);</span>
<span class="special">}</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">spawn</span><span class="special">(</span><span class="identifier">my_executor</span><span class="special">,</span> <span class="identifier">do_read</span><span class="special">,</span>
<span class="special">[](</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">exception_ptr</span> <span class="identifier">ex</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">result</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="special">});</span>
</pre>
<p class="simpara">
These new <code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code>
overloads support cancellation, and the <code class="computeroutput"><span class="identifier">basic_yield_context</span></code>
completion token has also been enhanced to support move-only and variadic
result types. When targeting C++11 and later, these functions are implemented
in terms of Boost.Context directly. The existing overloads have been retained
but are deprecated.
</p>
</li>
<li class="listitem">
<p class="simpara">
Added the <code class="computeroutput"><span class="identifier">is_async_operation</span></code>
trait and <code class="computeroutput"><span class="identifier">async_operation</span></code>
concept. The <code class="computeroutput"><span class="identifier">is_async_operation</span></code>
trait may be used to determine if a function object, and optional arguments,
may be called to initiate an asynchronous operation. For example, when
using <code class="computeroutput"><span class="identifier">deferred</span></code>:<br>
</p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="identifier">d</span> <span class="special">=</span> <span class="identifier">my_timer</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">deferred</span><span class="special">);</span>
<span class="keyword">static_assert</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">is_async_operation</span><span class="special">&lt;</span><span class="keyword">decltype</span><span class="special">(</span><span class="identifier">d</span><span class="special">)&gt;::</span><span class="identifier">value</span><span class="special">);</span>
</pre>
<p class="simpara">
<br> or with a handcrafted asynchronous operation:<br>
</p>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">my_async_op</span>
<span class="special">{</span>
2023-10-25 13:08:15 -04:00
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">&amp;</span> <span class="identifier">local_socket</span> <span class="special">=</span> <span class="special">...;</span>
2023-10-24 21:59:30 -04:00
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Token</span><span class="special">&gt;</span>
<span class="keyword">auto</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">const_buffer</span> <span class="identifier">data</span><span class="special">,</span> <span class="identifier">Token</span><span class="special">&amp;&amp;</span> <span class="identifier">token</span><span class="special">)</span>
<span class="special">{</span>
2023-10-25 13:08:15 -04:00
<span class="keyword">return</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">async_write</span><span class="special">(</span><span class="identifier">local_socket</span><span class="special">,</span> <span class="identifier">data</span><span class="special">,</span>
2023-10-24 21:59:30 -04:00
<span class="identifier">std</span><span class="special">::</span><span class="identifier">forward</span><span class="special">&lt;</span><span class="identifier">Token</span><span class="special">&gt;(</span><span class="identifier">token</span><span class="special">));</span>
<span class="special">}</span>
<span class="special">};</span>
<span class="keyword">static_assert</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">is_async_operation</span><span class="special">&lt;</span>
<span class="identifier">my_async_op</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">const_buffer</span><span class="special">&gt;::</span><span class="identifier">value</span><span class="special">);</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
<p class="simpara">
Added the <code class="computeroutput"><span class="identifier">completion_signature_of</span></code>
trait. The <code class="computeroutput"><span class="identifier">completion_signature_of</span></code>
trait (and corresponding type alias <code class="computeroutput"><span class="identifier">completion_signature_of_t</span></code>)
may be used to determine the completion signature of an asynchronous operation.
For example:<br>
</p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="identifier">d</span> <span class="special">=</span> <span class="identifier">my_timer</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">deferred</span><span class="special">);</span>
<span class="keyword">using</span> <span class="identifier">sig</span> <span class="special">=</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">completion_signature_of</span><span class="special">&lt;</span><span class="keyword">decltype</span><span class="special">(</span><span class="identifier">d</span><span class="special">)&gt;::</span><span class="identifier">type</span><span class="special">;</span>
<span class="comment">// sig is void(error_code)</span>
</pre>
<p class="simpara">
<br> or with a handcrafted asynchronous operation:<br>
</p>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">my_async_op</span>
<span class="special">{</span>
2023-10-25 13:08:15 -04:00
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">&amp;</span> <span class="identifier">local_socket</span> <span class="special">=</span> <span class="special">...;</span>
2023-10-24 21:59:30 -04:00
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Token</span><span class="special">&gt;</span>
<span class="keyword">auto</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">const_buffer</span> <span class="identifier">data</span><span class="special">,</span> <span class="identifier">Token</span><span class="special">&amp;&amp;</span> <span class="identifier">token</span><span class="special">)</span>
<span class="special">{</span>
2023-10-25 13:08:15 -04:00
<span class="keyword">return</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">async_write</span><span class="special">(</span><span class="identifier">local_socket</span><span class="special">,</span> <span class="identifier">data</span><span class="special">,</span>
2023-10-24 21:59:30 -04:00
<span class="identifier">std</span><span class="special">::</span><span class="identifier">forward</span><span class="special">&lt;</span><span class="identifier">Token</span><span class="special">&gt;(</span><span class="identifier">token</span><span class="special">));</span>
<span class="special">}</span>
<span class="special">};</span>
<span class="keyword">using</span> <span class="identifier">sig</span> <span class="special">=</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">completion_signature_of</span><span class="special">&lt;</span>
<span class="identifier">my_async_op</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">const_buffer</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">;</span>
<span class="comment">// sig is void(error_code, size_t)</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
Added converting move construction/assignment to posix descriptors, serial
ports, pipes, Windows <code class="computeroutput"><span class="identifier">object_handle</span></code>,
Windows stream handles, and Windows random-access handles.
</li>
<li class="listitem">
Added <code class="computeroutput"><span class="identifier">release</span><span class="special">()</span></code>
member functions to pipes, Windows stream handles, and Windows random-access
handles.
</li>
<li class="listitem">
Enabled support for <code class="computeroutput"><span class="identifier">Endpoint</span></code>
implementations that return <code class="computeroutput"><span class="keyword">void</span></code>
pointers from their <code class="computeroutput"><span class="identifier">data</span><span class="special">()</span></code> member functions, as per the documented
<code class="computeroutput"><span class="identifier">Endpoint</span></code> type requirements.
</li>
<li class="listitem">
Removed <code class="computeroutput"><span class="identifier">all</span><span class="special">()</span></code>
and <code class="computeroutput"><span class="identifier">race</span><span class="special">()</span></code>
from <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">promise</span></code>, as <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">parallel_group</span></code>
covers this functionality.
</li>
<li class="listitem">
Added source locations to exceptions and error codes produced by the synchronous
and asynchronous operations.
</li>
<li class="listitem">
Fixed compatibility with OpenSSL 3.0.4 and later.
</li>
<li class="listitem">
Fixed compatibility with with <code class="literal">-masm=intel</code>.
</li>
<li class="listitem">
Explicitly stated that socket <code class="computeroutput"><span class="identifier">shutdown</span><span class="special">()</span></code> calls are thread-safe with respect to
certain other synchronous operations on the same socket.
</li>
<li class="listitem">
Optimised the move construction of I/O objects where only the executor
type differs.
</li>
<li class="listitem">
Fixed the detection of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invoke_result</span></code>
for clang/libc++.
</li>
<li class="listitem">
Fixed an issue where <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">parallel_group</span></code>
initiation incorrectly moved arguments instead of forwarding them.
</li>
<li class="listitem">
Fixed a sequencing issue in the implementation of <code class="computeroutput"><span class="identifier">post</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">dispatch</span><span class="special">()</span></code>, and <code class="computeroutput"><span class="identifier">defer</span><span class="special">()</span></code>, where the the associated allocator may
be obtained from an already moved-from completion handler.
</li>
<li class="listitem">
Fixed the <code class="computeroutput"><span class="identifier">awaitable</span><span class="special">&lt;&gt;</span></code>
implementation to propagate exceptions from awaited initiation functions
through the current completion handler.
</li>
<li class="listitem">
Fixed detection of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">aligned_alloc</span></code>
with <code class="literal">gcc</code>.
</li>
<li class="listitem">
Changed to avoid using the soon-to-be-deprecated <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">aligned_storage</span></code>
on newer compilers.
</li>
<li class="listitem">
Fixed various compiler warnings.
</li>
<li class="listitem">
Updated all composed operations examples, and the C++11 timeouts example,
to use the new <code class="computeroutput"><span class="identifier">async_result</span></code>
form.
</li>
<li class="listitem">
Added composed operation and coroutine examples for C++20.
</li>
<li class="listitem">
Added pkg-config support.
</li>
</ul></div>
<h4>
<a name="asio.history.h7"></a>
<span><a name="asio.history.asio_1_22_2"></a></span><a class="link" href="history.html#asio.history.asio_1_22_2">Asio
1.22.2</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
On Windows, changed the file support to open files using the same sharing
mode as <code class="computeroutput"><span class="identifier">fopen</span><span class="special">()</span></code>.
</li>
<li class="listitem">
On Linux, fixed the UNIX domain sockets implementation to correctly handle
<code class="computeroutput"><span class="identifier">EAGAIN</span></code> as an indication
of an in-progress connect operation.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">basic_channel</span><span class="special">::</span><span class="identifier">reset</span><span class="special">()</span></code>
and <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">basic_concurrent_channel</span><span class="special">::</span><span class="identifier">reset</span><span class="special">()</span></code>
so that they work correctly for an unclosed channel.
</li>
<li class="listitem">
Fixed potential undefined behaviour in the <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">promise</span></code>
operations <code class="computeroutput"><span class="identifier">race</span><span class="special">()</span></code>
and <code class="computeroutput"><span class="identifier">all</span><span class="special">()</span></code>.
</li>
<li class="listitem">
Changed the <code class="computeroutput"><span class="identifier">co_spawn</span></code> implementation
to explicitly dispatch cancellation signals through the specified executor,
if the the completion handler has an associated executor of its own.
</li>
<li class="listitem">
Added more detailed reference documentation to <code class="computeroutput"><span class="identifier">make_strand</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">make_work_guard</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">address_v4</span></code>,
<code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">address_v6</span></code>, <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">basic_channel</span></code>,
and <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">basic_concurrent_channel</span></code>.
</li>
<li class="listitem">
Re-arranged and extended the Overview documentation to cover files, pipes,
<code class="computeroutput"><span class="identifier">async_compose</span></code>, <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">deferred</span></code>, <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">parallel_group</span></code>,
<code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">promise</span></code>, channels, and completion token
adapters.
</li>
<li class="listitem">
Reverted the <code class="computeroutput"><span class="identifier">io_context</span></code>
reference documentation to use <code class="computeroutput"><span class="identifier">executor_work_guard</span></code>
when preventing the <code class="computeroutput"><span class="identifier">io_context</span></code>
from running out of work.
</li>
<li class="listitem">
Removed references to <code class="computeroutput"><span class="identifier">deadline_timer</span></code>
from the Overview documentation.
</li>
<li class="listitem">
Added reference documentation cross-references to asynchronous model elements.
</li>
</ul></div>
<h4>
<a name="asio.history.h8"></a>
<span><a name="asio.history.asio_1_22_1"></a></span><a class="link" href="history.html#asio.history.asio_1_22_1">Asio
1.22.1</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added <code class="computeroutput"><span class="identifier">bind_allocator</span></code>, to
simplify associating a custom allocator with a completion token or handler.
</li>
<li class="listitem">
Added the <code class="computeroutput"><span class="identifier">file_base</span><span class="special">::</span><span class="identifier">sync_all_on_write</span></code> flag, which maps to
<code class="computeroutput"><span class="identifier">O_SYNC</span></code> on POSIX and <code class="computeroutput"><span class="identifier">FILE_FLAG_WRITE_THROUGH</span></code> on Windows.
</li>
<li class="listitem">
Added missing implementation of <code class="computeroutput"><span class="identifier">basic_file</span><span class="special">::</span><span class="identifier">release</span><span class="special">()</span></code>.
</li>
<li class="listitem">
Added per-operation cancellation support to signal sets.
</li>
<li class="listitem">
Exposed <code class="computeroutput"><span class="identifier">recycling_allocator</span></code>
as part of the public interface.
</li>
<li class="listitem">
Added the <code class="computeroutput"><span class="identifier">nodiscard</span></code> attribute
to the following functions:
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
<code class="computeroutput"><span class="identifier">bind_allocator</span><span class="special">()</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">bind_cancellation_slot</span><span class="special">()</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">bind_executor</span><span class="special">()</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">buffer</span><span class="special">()</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">dynamic_buffer</span><span class="special">()</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">append</span><span class="special">()</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">as_single</span><span class="special">()</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">as_tuple</span><span class="special">()</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">make_parallel_group</span><span class="special">()</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">prepend</span><span class="special">()</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">get_associated_allocator</span><span class="special">()</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">get_associated_cancellation_slot</span><span class="special">()</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">get_associated_executor</span><span class="special">()</span></code>
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">make_work_guard</span><span class="special">()</span></code>
</li>
</ul></div>
</li>
<li class="listitem">
Added compatibility with OpenSSL 3.0, particularly when deprecated functionality
is disabled.
</li>
<li class="listitem">
Added support for adopting an existing <code class="computeroutput"><span class="identifier">SSL</span><span class="special">*</span></code> into an <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span><span class="special">&lt;&gt;</span></code>.
</li>
<li class="listitem">
Enabled <code class="computeroutput"><span class="identifier">executor_work_guard</span><span class="special">&lt;&gt;</span></code> even when <code class="computeroutput"><span class="identifier">ASIO_NO_TS_EXECUTORS</span></code>
is defined.
</li>
<li class="listitem">
Enabled movable socket iostreams when using clang.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">bind_cancellation_slot</span></code>
compatibility with legacy completion tokens.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">bind_executor</span></code> compatibility
with legacy completion tokens.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">associator</span></code> specialisations
for <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">append</span></code> and <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">prepend</span></code>,
to correctly propagate the associated allocator, executor, and cancellation
slot.
</li>
<li class="listitem">
Fixed 'zero as null pointer constant' warning in C++20 coroutines implementation
of <code class="computeroutput"><span class="identifier">awaitable</span></code>.
</li>
<li class="listitem">
Ensured concurrency hint preprocessor macros are made available when <code class="literal">asio/io_context.hpp</code>
is included.
</li>
<li class="listitem">
Fixed issue where the primary <code class="computeroutput"><span class="identifier">associated_allocator</span></code>
template was not correctly detecting the nested <code class="computeroutput"><span class="identifier">T</span><span class="special">::</span><span class="identifier">allocator_type</span></code>.
</li>
<li class="listitem">
Fixed <code class="literal">io_uring</code> implementation of <code class="computeroutput"><span class="identifier">async_receive_from</span></code>
operation for sockets.
</li>
<li class="listitem">
Fixed <code class="literal">io_uring</code> implementation of <code class="computeroutput"><span class="identifier">write_some_at</span></code>
operation for files.
</li>
<li class="listitem">
Changed <code class="literal">io_uring</code> implementation to correctly check that
it is not the default before registering with reactor.
</li>
<li class="listitem">
Fixed a circular inclusion issue when using <code class="literal">io_uring</code>
in some build configurations.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">coro</span></code>'s per-operation cancellation to
clear the slot at completion of each operation.
</li>
<li class="listitem">
Fixed memory management in <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">promise</span></code>'s
type-erased completion handlers.
</li>
<li class="listitem">
Fixed move <code class="computeroutput"><span class="keyword">operator</span><span class="special">=</span></code>
implementation for <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span></code>.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">any_io_executor</span></code> implementation
to work when both <code class="computeroutput"><span class="identifier">ASIO_USE_TS_EXECUTOR_AS_DEFAULT</span></code>
and <code class="computeroutput"><span class="identifier">ASIO_SEPARATE_COMPILATION</span></code>
are defined.
</li>
<li class="listitem">
Fixed implementation of <code class="computeroutput"><span class="identifier">basic_socket</span><span class="special">::</span><span class="identifier">at_mark</span><span class="special">()</span></code> when using the <code class="computeroutput"><span class="identifier">sockatmark</span><span class="special">()</span></code> system call.
</li>
<li class="listitem">
Changed the recycling allocator to use the default alignment as the minimum
alignment for allocations.
</li>
<li class="listitem">
Added additional standard header file includes, as required by newer compilers.
</li>
<li class="listitem">
Added a workaround for apparent coroutine codegen bug with Apple's clang.
</li>
<li class="listitem">
Fixed various warnings in the examples and unit tests.
</li>
<li class="listitem">
Added a C++11 example showing file descriptor passing over local sockets.
Thanks to Heiko Hund for providing this example.
</li>
<li class="listitem">
Added C++14 examples of wrapping callback-based APIs in asynchronous operations.
</li>
<li class="listitem">
Added an overview of Asio's asynchronous model to the documentation.
</li>
<li class="listitem">
Reworked reference documentation in terms of completion tokens.
</li>
<li class="listitem">
Updated documentation of asynchronous operation requirements to use new
completion token form.
</li>
<li class="listitem">
Updated documentation for <code class="computeroutput"><span class="identifier">dispatch</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">post</span><span class="special">()</span></code>, and <code class="computeroutput"><span class="identifier">defer</span><span class="special">()</span></code> to cover both the old and new executor
forms.
</li>
<li class="listitem">
Documented per-operation cancellation for serial ports.
</li>
<li class="listitem">
Clarified the non-concurrency guarantees made for allocators.
</li>
</ul></div>
<h4>
<a name="asio.history.h9"></a>
<span><a name="asio.history.asio_1_22_0"></a></span><a class="link" href="history.html#asio.history.asio_1_22_0">Asio
1.22.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Improved error messages emitted by <code class="computeroutput"><span class="identifier">ssl</span></code>
facilities.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">bind_executor</span></code> compatibility
with completion tokens.
</li>
<li class="listitem">
Fixed build errors when <code class="computeroutput"><span class="identifier">ASIO_USE_TS_EXECUTOR_AS_DEFAULT</span></code>
is defined.
</li>
<li class="listitem">
Fixed corruption, cleanup issues in channel implementation.
</li>
<li class="listitem">
Added missing move assignment operator to <code class="computeroutput"><span class="identifier">awaitable</span><span class="special">&lt;&gt;</span></code>.
</li>
<li class="listitem">
Fixed an access violation when using coroutines with MSVC, due to incorrect
alignment of allocated memory.
</li>
<li class="listitem">
Fixed a cleanup issue in <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">parallel_group</span></code>
that occured when the execution context was shut down with parallel operations
still pending.
</li>
<li class="listitem">
Fixed header inclusion order problem when io_uring is enabled.
</li>
<li class="listitem">
Eliminated <code class="computeroutput"><span class="identifier">shared_ptr</span></code> use
from <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">coro</span></code> <code class="computeroutput"><span class="identifier">co_spawn</span><span class="special">()</span></code> implementation.
</li>
<li class="listitem">
Prevented <code class="computeroutput"><span class="identifier">async_resume</span></code>
from being called on <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">coro</span></code>
temporaries.
</li>
<li class="listitem">
Made <code class="computeroutput"><span class="identifier">awaitable_operators</span><span class="special">.</span><span class="identifier">hpp</span></code>
header self-contained.
</li>
<li class="listitem">
Added clarifications to the documentation on concurrency hints.
</li>
<li class="listitem">
Added documentation on error handling techniques for C++20 coroutines.
</li>
<li class="listitem">
Added channel-based proxy example.
</li>
<li class="listitem">
Regenerated <code class="computeroutput"><span class="identifier">ssl</span></code> certificates
used in examples.
</li>
</ul></div>
<h4>
<a name="asio.history.h10"></a>
<span><a name="asio.history.asio_1_21_0"></a></span><a class="link" href="history.html#asio.history.asio_1_21_0">Asio
1.21.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added an io_uring backend. This backend may be used for all I/O objects,
including sockets, timers, and posix descriptors.<br> <br> The backend
is disabled by default, and must be enabled by defining both <code class="computeroutput"><span class="identifier">ASIO_HAS_IO_URING</span></code> and <code class="computeroutput"><span class="identifier">ASIO_DISABLE_EPOLL</span></code>.<br>
<br> Simply defining <code class="computeroutput"><span class="identifier">ASIO_HAS_IO_URING</span></code>
alone will enable the backend without using it for the existing I/O objects.
This allows it to be used for I/O objects that require io_uring support,
such as files.<br> <br> This support depends on the <code class="literal">liburing</code>
library at both compile and link time. Add <code class="computeroutput"><span class="special">-</span><span class="identifier">luring</span></code> to your list of libraries for
linking.
</li>
<li class="listitem">
<p class="simpara">
Added support for files. This introduces new classes for stream-oriented
and random-access files. For example, to write to a newly created stream-oriented
file:<br>
</p>
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">stream_file</span> <span class="identifier">file</span><span class="special">(</span>
<span class="identifier">my_io_context</span><span class="special">,</span> <span class="string">"/path/to/file"</span><span class="special">,</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">stream_file</span><span class="special">::</span><span class="identifier">write_only</span>
<span class="special">|</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">stream_file</span><span class="special">::</span><span class="identifier">create</span>
<span class="special">|</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">stream_file</span><span class="special">::</span><span class="identifier">truncate</span><span class="special">);</span>
<span class="identifier">file</span><span class="special">.</span><span class="identifier">async_write_some</span><span class="special">(</span><span class="identifier">my_buffer</span><span class="special">,</span>
<span class="special">[](</span><span class="identifier">error_code</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">n</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="special">});</span>
</pre>
<p class="simpara">
<br> or to read from a random-access file:<br>
</p>
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">random_access_file</span> <span class="identifier">file</span><span class="special">(</span>
<span class="identifier">my_io_context</span><span class="special">,</span> <span class="string">"/path/to/file"</span><span class="special">,</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">random_access_file</span><span class="special">::</span><span class="identifier">read_only</span><span class="special">);</span>
<span class="identifier">file</span><span class="special">.</span><span class="identifier">async_read_some_at</span><span class="special">(</span><span class="number">1234</span><span class="special">,</span> <span class="identifier">my_buffer</span><span class="special">,</span>
<span class="special">[](</span><span class="identifier">error_code</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">n</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="special">});</span>
</pre>
<p class="simpara">
<br> This feature currently supports I/O completion ports on Windows,
and io_uring on Linux (define <code class="computeroutput"><span class="identifier">ASIO_HAS_IO_URING</span></code>
to enable).
</p>
</li>
<li class="listitem">
<p class="simpara">
Added support for portable pipes. This change add supports for pipes on
POSIX and Windows (when I/O completion ports are available). For example,
to create and use a connected pair of pipe objects:<br>
</p>
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">readable_pipe</span> <span class="identifier">read_end</span><span class="special">;</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">writable_pipe</span> <span class="identifier">write_end</span><span class="special">;</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">connect_pipe</span><span class="special">(</span><span class="identifier">read_end</span><span class="special">,</span> <span class="identifier">write_end</span><span class="special">);</span>
<span class="identifier">write_end</span><span class="special">.</span><span class="identifier">async_write_some</span><span class="special">(</span><span class="identifier">my_write_buffer</span><span class="special">,</span>
<span class="special">[](</span><span class="identifier">error_code</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">n</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="special">});</span>
<span class="identifier">read_end</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">my_read_buffer</span><span class="special">,</span>
<span class="special">[](</span><span class="identifier">error_code</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">n</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="special">});</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
<p class="simpara">
Added support for registered buffers. The <code class="computeroutput"><span class="identifier">mutable_registered_buffer</span></code>
and <code class="computeroutput"><span class="identifier">const_registered_buffer</span></code>
classes are buffer sequence types that represent registered buffers. These
buffers are obtained by first performing a buffer registration:<br>
</p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="identifier">my_registration</span> <span class="special">=</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">register_buffers</span><span class="special">(</span>
<span class="identifier">my_execution_context</span><span class="special">,</span>
<span class="identifier">my_buffer_sequence</span><span class="special">);</span>
</pre>
<p class="simpara">
<br> The registration object must be maintained for as long as the buffer
registration is required. The supplied buffer sequence represents the memory
location or locations that will be registered, and the caller must ensure
they remain valid for as long as they are registered. The registration
is automatically removed when the registration object is destroyed. There
can be at most one active registration per execution context.<br> <br>
The registration object is a container of registered buffers. Buffers may
be obtained from it by iterating over the container, or via direct index
access:<br>
</p>
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">mutable_registered_buffer</span> <span class="identifier">my_buffer</span>
<span class="special">=</span> <span class="identifier">my_registration</span><span class="special">[</span><span class="identifier">i</span><span class="special">];</span>
</pre>
<p class="simpara">
<br> The registered buffers may then be passed directly to operations:<br>
</p>
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">async_read</span><span class="special">(</span><span class="identifier">my_socket</span><span class="special">,</span> <span class="identifier">my_buffer</span><span class="special">,</span>
<span class="special">[](</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">n</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="special">});</span>
</pre>
<p class="simpara">
<br> Buffer registration supports the io_uring backend when used with
read and write operations on descriptors, files, pipes, and sockets. For
portability, the facility may be used on other platforms, but the registered
buffers will behave as normal buffers.
</p>
</li>
<li class="listitem">
<p class="simpara">
Added experimental support for channels. This adds templates <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">basic_channel</span></code> and <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">basic_concurrent_channel</span></code>,
with aliases <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">channel</span></code>
and <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">concurrent_channel</span></code>. Channels may be used
to send completions as messages. For example:<br>
</p>
<pre class="programlisting"><span class="comment">// Create a channel with no buffer space.</span>
<span class="identifier">channel</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">error_code</span><span class="special">,</span> <span class="identifier">size_t</span><span class="special">)&gt;</span> <span class="identifier">ch</span><span class="special">(</span><span class="identifier">ctx</span><span class="special">);</span>
<span class="comment">// The call to try_send fails as there is no buffer</span>
<span class="comment">// space and no waiting receive operations.</span>
<span class="keyword">bool</span> <span class="identifier">ok</span> <span class="special">=</span> <span class="identifier">ch</span><span class="special">.</span><span class="identifier">try_send</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error</span><span class="special">::</span><span class="identifier">eof</span><span class="special">,</span> <span class="number">123</span><span class="special">);</span>
<span class="identifier">assert</span><span class="special">(!</span><span class="identifier">ok</span><span class="special">);</span>
<span class="comment">// The async_send operation is outstanding until</span>
<span class="comment">// a receive operation consumes the message.</span>
<span class="identifier">ch</span><span class="special">.</span><span class="identifier">async_send</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error</span><span class="special">::</span><span class="identifier">eof</span><span class="special">,</span> <span class="number">123</span><span class="special">,</span>
<span class="special">[](</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="special">});</span>
<span class="comment">// The async_receive consumes the message. Both the</span>
<span class="comment">// async_send and async_receive operations complete</span>
<span class="comment">// immediately.</span>
<span class="identifier">ch</span><span class="special">.</span><span class="identifier">async_receive</span><span class="special">(</span>
<span class="special">[](</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">n</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="special">});</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
Implemented improvements to <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">coro</span></code>.
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
Added overload so member functions can provide an explicit executor.
</li>
<li class="listitem">
Added <code class="computeroutput"><span class="identifier">co_spawn</span></code> for
<code class="computeroutput"><span class="identifier">coro</span></code> tasks.
</li>
<li class="listitem">
Added reference and overview documentation.
</li>
<li class="listitem">
Adopted awaitable cancellation model.
</li>
<li class="listitem">
Refactored implementation.
</li>
</ul></div>
</li>
<li class="listitem">
Disabled <code class="computeroutput"><span class="identifier">aligned_alloc</span></code>
on <code class="literal">clang</code> when using an MSVC runtime.
</li>
<li class="listitem">
Changed to use a faster implementation for <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">network_v4</span><span class="special">::</span><span class="identifier">canonical</span><span class="special">()</span></code>.
</li>
<li class="listitem">
Added template specialisations for common uses to improve compile time.
</li>
<li class="listitem">
Reduced the size of <code class="computeroutput"><span class="identifier">io_context</span></code>
executors to a single pointer.
</li>
<li class="listitem">
Increased the small object buffer size for <code class="computeroutput"><span class="identifier">execution</span><span class="special">::</span><span class="identifier">any_executor</span></code>
and <code class="computeroutput"><span class="identifier">any_io_executor</span></code>.
</li>
<li class="listitem">
Fixed multi-signature handling when variadic templates are disabled.
</li>
<li class="listitem">
Fixed compatibility with new versions of <code class="literal">gcc</code> and <code class="literal">clang</code>.
</li>
<li class="listitem">
Fixed compilation on Solaris.
</li>
<li class="listitem">
Fix defence against Qt-defined macros when building with MSVC.
</li>
<li class="listitem">
Fixed various warnings.
</li>
</ul></div>
<h4>
<a name="asio.history.h11"></a>
<span><a name="asio.history.asio_1_20_0"></a></span><a class="link" href="history.html#asio.history.asio_1_20_0">Asio
1.20.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">coro</span></code> compatibility with <code class="literal">gcc</code>.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">promise</span></code> compatibility with <code class="literal">gcc</code>.
</li>
<li class="listitem">
Added documentation for per-operation cancellation.
</li>
<li class="listitem">
Added documentation for <code class="computeroutput"><span class="identifier">parallel_group</span></code>.
</li>
<li class="listitem">
Added overview documentation for <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">coro</span></code>.
</li>
<li class="listitem">
Added some missing C++14 examples.
</li>
<li class="listitem">
Updated C++20 coroutines overview documentation.
</li>
</ul></div>
<h4>
<a name="asio.history.h12"></a>
<span><a name="asio.history.asio_1_19_2"></a></span><a class="link" href="history.html#asio.history.asio_1_19_2">Asio
1.19.2</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Cleaned up memory recycling to ensure the cache size is used consistently.
</li>
<li class="listitem">
Changed <code class="computeroutput"><span class="identifier">parallel_group</span></code>
to use the recycling allocator for shared state.
</li>
<li class="listitem">
Changed <code class="computeroutput"><span class="identifier">awaitable</span></code> memory
recycling to use the configurable cache size.
</li>
<li class="listitem">
Ensured <code class="computeroutput"><span class="identifier">parallel_group</span></code>
respects operations' associated executors.
</li>
<li class="listitem">
Added defence against macros defined by Qt.
</li>
<li class="listitem">
Added missing <code class="computeroutput"><span class="identifier">boost_</span></code> prefix
to namespaces during boostification.
</li>
<li class="listitem">
Added missing lvalue-qualified overloads for <code class="computeroutput"><span class="identifier">deferred</span></code>
operator().
</li>
<li class="listitem">
Added a tag to disambiguate <code class="computeroutput"><span class="identifier">deferred</span></code>
constructors.
</li>
<li class="listitem">
Added missing <code class="computeroutput"><span class="identifier">push</span></code>/<code class="computeroutput"><span class="identifier">pop_options</span></code> includes.
</li>
<li class="listitem">
Fixed argument evaluation order issue with a potentially moved-from variable
in <code class="computeroutput"><span class="identifier">awaitable</span></code> implementation.
</li>
<li class="listitem">
Enabled "expression SFINAE" for recent MSVC using <code class="computeroutput"><span class="special">/</span><span class="identifier">std</span><span class="special">:</span><span class="identifier">c</span><span class="special">++</span><span class="identifier">latest</span></code>.
</li>
<li class="listitem">
Fixed compilation errors when <code class="computeroutput"><span class="identifier">dev_poll_reactor</span></code>
backend is used.
</li>
<li class="listitem">
Fixed handler type requirements checking to reflect rvalue completion handler
invocation.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">posix</span><span class="special">::</span><span class="identifier">basic_stream_descriptor</span></code> move operations
to work with non-defaulted executors.
</li>
<li class="listitem">
Added missing move of executor in strand implementation.
</li>
</ul></div>
<h4>
<a name="asio.history.h13"></a>
<span><a name="asio.history.asio_1_19_1"></a></span><a class="link" href="history.html#asio.history.asio_1_19_1">Asio
1.19.1</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Fixed handling of move-only results with awaitable operators <code class="computeroutput"><span class="special">&amp;&amp;</span></code> and <code class="computeroutput"><span class="special">||</span></code>.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">strand</span><span class="special">&lt;&gt;</span></code>
to avoid using a potentially moved-from executor.
</li>
<li class="listitem">
Fixed order of <code class="computeroutput"><span class="identifier">_aligned_malloc</span></code>
arguments for MSVC.
</li>
<li class="listitem">
Ensured handler alignment requirements are respected by <code class="computeroutput"><span class="identifier">cancellation_signal</span></code>.
</li>
<li class="listitem">
Ensured <code class="literal">gcc</code> tests are not used for <code class="literal">clang</code>
when detecting compiler features.
</li>
<li class="listitem">
Disabled coroutines support for the <code class="literal">clang</code> shipped with
MSVC.
</li>
<li class="listitem">
Fixed compatibility with recent LibreSSL when <code class="computeroutput"><span class="identifier">OPENSSL_NO_SSL_INTERN</span></code>
is defined.
</li>
<li class="listitem">
Documented supported cancellation types for individual asynchronous operations.
</li>
<li class="listitem">
Ensured un-cancelled ops are correctly placed back in the queue.
</li>
</ul></div>
<h4>
<a name="asio.history.h14"></a>
<span><a name="asio.history.asio_1_19_0"></a></span><a class="link" href="history.html#asio.history.asio_1_19_0">Asio
1.19.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added support for cancellation of individual asynchronous operations. Cancellation
is implemented by having each completion handler carry an associated <code class="computeroutput"><span class="identifier">CancellationSlot</span></code>, a lightweight cancellation
channel that is specified through the new <code class="computeroutput"><span class="identifier">associated_cancellation_slot</span></code>
associator. A concrete <code class="computeroutput"><span class="identifier">CancellationSlot</span></code>
implementation is provided in the form of the <code class="computeroutput"><span class="identifier">cancellation_signal</span></code>
and <code class="computeroutput"><span class="identifier">cancellation_slot</span></code> classes.
In conjunction with the <code class="computeroutput"><span class="identifier">bind_cancellation_slot</span></code>
helper function, these may be used to hook cancellation into asynchronous
operations. However, it should be noted that these classes are the low-level
building blocks of cancellation, and most use cases should use a higher
level abstraction for cancellation, such as <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">parallel_group</span></code>
or the new logical operators for <code class="computeroutput"><span class="identifier">awaitable</span></code>
(see below). The ability to cancel individual operations, or composed operations,
is currently supported by:
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
timers
</li>
<li class="listitem">
sockets on POSIX and Windows
</li>
<li class="listitem">
POSIX descriptors
</li>
<li class="listitem">
Windows HANDLEs
</li>
<li class="listitem">
SSL streams
</li>
<li class="listitem">
all Asio-provided composed operations such as <code class="computeroutput"><span class="identifier">async_read</span></code>
and <code class="computeroutput"><span class="identifier">async_write</span></code>
</li>
<li class="listitem">
compositions based on <code class="computeroutput"><span class="identifier">async_compose</span></code>
</li>
<li class="listitem">
C++20 coroutines that use <code class="computeroutput"><span class="identifier">awaitable</span></code>
</li>
<li class="listitem">
C++20 coroutines that use the new <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">coro</span></code>
(see below)
</li>
<li class="listitem">
the new <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">parallel_group</span></code>
operation (see below)
</li>
<li class="listitem">
the new <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">promise</span></code>
class (see below)
</li>
</ul></div>
</li>
<li class="listitem">
<p class="simpara">
Added the <code class="computeroutput"><span class="identifier">associator</span></code> trait.
The <code class="computeroutput"><span class="identifier">associator</span></code> trait is
used to generically forward associators, such as <code class="computeroutput"><span class="identifier">associated_executor</span></code>
and <code class="computeroutput"><span class="identifier">associated_allocator</span></code>,
through intermediate completion handlers. For example:<br>
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Handler</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">intermediate_handler</span>
<span class="special">{</span>
<span class="identifier">Handler</span> <span class="identifier">handler_</span><span class="special">;</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span><span class="special">...</span> <span class="identifier">Args</span><span class="special">&gt;</span>
<span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">Args</span><span class="special">&amp;...</span> <span class="identifier">args</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="special">}</span>
<span class="special">};</span>
<span class="keyword">namespace</span> <span class="identifier">asio</span> <span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span><span class="special">,</span> <span class="keyword">typename</span><span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">Associator</span><span class="special">,</span>
<span class="keyword">typename</span> <span class="identifier">Handler</span><span class="special">,</span>
<span class="keyword">typename</span> <span class="identifier">DefaultCandidate</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">associator</span><span class="special">&lt;</span>
<span class="identifier">Associator</span><span class="special">,</span>
<span class="identifier">intermediate_handler</span><span class="special">&lt;</span><span class="identifier">Handler</span><span class="special">&gt;,</span>
<span class="identifier">DefaultCandidate</span><span class="special">&gt;</span>
<span class="special">{</span>
<span class="keyword">using</span> <span class="identifier">type</span> <span class="special">=</span>
<span class="keyword">typename</span> <span class="identifier">Associator</span><span class="special">&lt;</span><span class="identifier">Handler</span><span class="special">,</span> <span class="identifier">DefaultCandidate</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">;</span>
<span class="keyword">static</span> <span class="identifier">type</span> <span class="identifier">get</span><span class="special">(</span>
<span class="keyword">const</span> <span class="identifier">intermediate_handler</span><span class="special">&lt;</span><span class="identifier">Handler</span><span class="special">&gt;&amp;</span> <span class="identifier">h</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">DefaultCandidate</span><span class="special">&amp;</span> <span class="identifier">c</span> <span class="special">=</span> <span class="identifier">DefaultCandidate</span><span class="special">())</span> <span class="keyword">noexcept</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">Associator</span><span class="special">&lt;</span><span class="identifier">Handler</span><span class="special">,</span> <span class="identifier">DefaultCandidate</span><span class="special">&gt;::</span><span class="identifier">get</span><span class="special">(</span>
<span class="identifier">h</span><span class="special">.</span><span class="identifier">handler_</span><span class="special">,</span> <span class="identifier">c</span><span class="special">);</span>
<span class="special">}</span>
<span class="special">};</span>
<span class="special">}</span> <span class="comment">// namespace asio</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
Changed all asynchronous operations implemented in Asio to invoke their
completion handlers as rvalue references. This allows an rvalue reference
qualifier to be added to the function call operator.
</li>
<li class="listitem">
<p class="simpara">
Added support for asynchronous operations with multiple completion signatures.
Completion signatures may also specify that they are <code class="computeroutput"><span class="keyword">noexcept</span></code>,
and whether they are lvalue-invocable (and thus do not "consume"
the completion handler) or rvalue-invocable (and thus do "consume"
the handler, indicating an end to the asynchronous operation). For example:<br>
</p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="identifier">my_async_operation</span><span class="special">(...,</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">completion_token_for</span><span class="special">&lt;</span>
<span class="keyword">void</span><span class="special">(</span><span class="identifier">intermediate_result_type</span><span class="special">)</span> <span class="special">&amp;</span> <span class="keyword">noexcept</span><span class="special">,</span>
<span class="keyword">void</span><span class="special">(</span><span class="identifier">final_result_type</span><span class="special">)</span> <span class="special">&amp;&amp;</span>
<span class="special">&gt;</span> <span class="keyword">auto</span><span class="special">&amp;&amp;</span> <span class="identifier">token</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="special">}</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
<p class="simpara">
Added <code class="computeroutput"><span class="keyword">operator</span><span class="special">&amp;&amp;</span></code>
and <code class="computeroutput"><span class="keyword">operator</span><span class="special">||</span></code>
for <code class="computeroutput"><span class="identifier">awaitable</span><span class="special">&lt;&gt;</span></code>.
The logical operators <code class="computeroutput"><span class="special">||</span></code> and
<code class="computeroutput"><span class="special">&amp;&amp;</span></code> have been overloaded
for <code class="computeroutput"><span class="identifier">awaitable</span><span class="special">&lt;&gt;</span></code>,
to allow coroutines to be trivially awaited in parallel.<br> <br> When
awaited using <code class="computeroutput"><span class="special">&amp;&amp;</span></code>,
the <code class="computeroutput"><span class="identifier">co_await</span></code> expression
waits until both operations have completed successfully. As a "short-circuit"
evaluation, if one operation fails with an exception, the other is immediately
cancelled. For example:<br>
</p>
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">tuple</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">&gt;</span> <span class="identifier">results</span> <span class="special">=</span>
<span class="identifier">co_await</span> <span class="special">(</span>
<span class="identifier">async_read</span><span class="special">(</span><span class="identifier">socket</span><span class="special">,</span> <span class="identifier">input_buffer</span><span class="special">,</span> <span class="identifier">use_awaitable</span><span class="special">)</span>
<span class="special">&amp;&amp;</span> <span class="identifier">async_write</span><span class="special">(</span><span class="identifier">socket</span><span class="special">,</span> <span class="identifier">output_buffer</span><span class="special">,</span> <span class="identifier">use_awaitable</span><span class="special">)</span>
<span class="special">);</span>
</pre>
<p class="simpara">
<br> When awaited using <code class="computeroutput"><span class="special">||</span></code>,
the <code class="computeroutput"><span class="identifier">co_await</span></code> expression
waits until either operation succeeds. As a "short-circuit" evaluation,
if one operation succeeds without throwing an exception, the other is immediately
cancelled. For example:<br>
</p>
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">variant</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">monostate</span><span class="special">&gt;</span> <span class="identifier">results</span> <span class="special">=</span>
<span class="identifier">co_await</span> <span class="special">(</span>
<span class="identifier">async_read</span><span class="special">(</span><span class="identifier">socket</span><span class="special">,</span> <span class="identifier">input_buffer</span><span class="special">,</span> <span class="identifier">use_awaitable</span><span class="special">)</span>
<span class="special">||</span> <span class="identifier">timer</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span><span class="identifier">use_awaitable</span><span class="special">)</span>
<span class="special">);</span>
</pre>
<p class="simpara">
<br> The operators may be enabled by adding the <code class="computeroutput"><span class="preprocessor">#include</span></code>:<br>
</p>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">asio</span><span class="special">/</span><span class="identifier">experimental</span><span class="special">/</span><span class="identifier">awaitable_operators</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<p class="simpara">
<br> and then bringing the contents of the <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">awaitable_operators</span></code>
namespace into scope:<br>
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">awaitable_operators</span><span class="special">;</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
<p class="simpara">
Added the <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">as_tuple</span></code>
completion token adapter. The <code class="computeroutput"><span class="identifier">as_tuple</span></code>
completion token adapter can be used to specify that the completion handler
arguments should be combined into a single tuple argument. The <code class="computeroutput"><span class="identifier">as_tuple</span></code> adapter may be used in conjunction
with <code class="computeroutput"><span class="identifier">use_awaitable</span></code> and
structured bindings as follows:<br>
</p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="special">[</span><span class="identifier">e</span><span class="special">,</span> <span class="identifier">n</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">co_await</span> <span class="identifier">socket</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">data</span><span class="special">),</span> <span class="identifier">as_tuple</span><span class="special">(</span><span class="identifier">use_awaitable</span><span class="special">));</span>
</pre>
<p class="simpara">
<br> Alternatively, it may be used as a default completion token like
so:<br>
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">default_token</span> <span class="special">=</span> <span class="identifier">as_tuple_t</span><span class="special">&lt;</span><span class="identifier">use_awaitable_t</span><span class="special">&lt;&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">tcp_socket</span> <span class="special">=</span> <span class="identifier">default_token</span><span class="special">::</span><span class="identifier">as_default_on_t</span><span class="special">&lt;</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">&gt;;</span>
<span class="comment">// ...</span>
<span class="identifier">awaitable</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">&gt;</span> <span class="identifier">do_read</span><span class="special">(</span><span class="identifier">tcp_socket</span> <span class="identifier">socket</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="keyword">auto</span> <span class="special">[</span><span class="identifier">e</span><span class="special">,</span> <span class="identifier">n</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">co_await</span> <span class="identifier">socket</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">data</span><span class="special">));</span>
<span class="comment">// ...</span>
<span class="special">}</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
<p class="simpara">
Added the <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">append</span></code>
completion token adapter. The <code class="computeroutput"><span class="identifier">append</span></code>
completion token adapter can be used to pass additional completion handler
arguments at the end of the completion signature. For example:<br>
</p>
<pre class="programlisting"><span class="identifier">timer</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">append</span><span class="special">(</span>
<span class="special">[](</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">i</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="special">},</span>
<span class="number">42</span><span class="special">)</span>
<span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">future</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">timer</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">append</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">use_future</span><span class="special">,</span>
<span class="number">42</span>
<span class="special">)</span>
<span class="special">);</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
<p class="simpara">
Added the <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">prepend</span></code>
completion token adapter. The <code class="computeroutput"><span class="identifier">prepend</span></code>
completion token adapter can be used to pass additional arguments before
the existing completion handler arguments. For example:<br>
</p>
<pre class="programlisting"><span class="identifier">timer</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">prepend</span><span class="special">(</span>
<span class="special">[](</span><span class="keyword">int</span> <span class="identifier">i</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="special">},</span>
<span class="number">42</span><span class="special">)</span>
<span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">future</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">tuple</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&gt;&gt;</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">timer</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">prepend</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">use_future</span><span class="special">,</span>
<span class="number">42</span>
<span class="special">)</span>
<span class="special">);</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
<p class="simpara">
Added the <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">deferred</span></code>
completion token. The <code class="computeroutput"><span class="identifier">deferred</span></code>
completion token takes a call to an asynchronous operation's initiating
function and turns it into a function object that accepts a completion
token. For example:<br>
</p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="identifier">deferred_op</span> <span class="special">=</span>
<span class="identifier">timer</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">deferred</span><span class="special">);</span>
<span class="special">...</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">deferred_op</span><span class="special">)(</span>
<span class="special">[](</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">){</span> <span class="special">...</span> <span class="special">});</span>
</pre>
<p class="simpara">
<br> or:<br>
</p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="identifier">deferred_op</span> <span class="special">=</span>
<span class="identifier">timer</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">deferred</span><span class="special">);</span>
<span class="special">...</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">future</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">&gt;</span> <span class="special">=</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">deferred_op</span><span class="special">)(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">use_future</span><span class="special">);</span>
</pre>
<p class="simpara">
<br> The deferred token also supports chaining, to create simple compositions:<br>
</p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="identifier">deferred_op</span> <span class="special">=</span>
<span class="identifier">timer</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">deferred</span><span class="special">(</span>
<span class="special">[&amp;](</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">timer</span><span class="special">.</span><span class="identifier">expires_after</span><span class="special">(</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">seconds</span><span class="special">(</span><span class="number">1</span><span class="special">));</span>
<span class="keyword">return</span> <span class="identifier">timer</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">deferred</span><span class="special">);</span>
<span class="special">});</span>
<span class="special">...</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">future</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">&gt;</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">deferred_op</span><span class="special">)(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">use_future</span><span class="special">);</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
<p class="simpara">
Added the <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">parallel_group</span></code>
class and <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">make_parallel_group</span></code>
function. This utility may be used to launch work that is performed in
parallel, and wait for one or all of the operations to complete. A <code class="computeroutput"><span class="identifier">parallel_group</span></code> implements automatic cancellation
of incomplete operations. For example:<br>
</p>
<pre class="programlisting"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">make_parallel_group</span><span class="special">(</span>
<span class="special">[&amp;](</span><span class="keyword">auto</span> <span class="identifier">token</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">stream</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">data</span><span class="special">),</span> <span class="identifier">token</span><span class="special">);</span>
<span class="special">},</span>
<span class="special">[&amp;](</span><span class="keyword">auto</span> <span class="identifier">token</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">timer</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span><span class="identifier">token</span><span class="special">);</span>
<span class="special">}</span>
<span class="special">).</span><span class="identifier">async_wait</span><span class="special">(</span>
<span class="identifier">experimental</span><span class="special">::</span><span class="identifier">wait_for_one</span><span class="special">(),</span>
<span class="special">[](</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">array</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">,</span> <span class="number">2</span><span class="special">&gt;</span> <span class="identifier">completion_order</span><span class="special">,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec1</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">n1</span><span class="special">,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec2</span>
<span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="special">}</span>
<span class="special">);</span>
</pre>
<p class="simpara">
<br> The conditions for completion of the group may be specified using
one of the four provided function objects <code class="computeroutput"><span class="identifier">wait_for_all</span></code>,
<code class="computeroutput"><span class="identifier">wait_for_one</span></code>, <code class="computeroutput"><span class="identifier">wait_for_one_success</span></code>, and <code class="computeroutput"><span class="identifier">wait_for_one_error</span></code>, or with a custom
function. The <code class="computeroutput"><span class="identifier">parallel_group</span></code>
class can also be combined with <code class="computeroutput"><span class="identifier">deferred</span></code>
as follows:<br>
</p>
<pre class="programlisting"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">make_parallel_group</span><span class="special">(</span>
<span class="identifier">stream</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">data</span><span class="special">),</span> <span class="identifier">experimental</span><span class="special">::</span><span class="identifier">deferred</span><span class="special">),</span>
<span class="identifier">timer</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">deferred</span><span class="special">)</span>
<span class="special">).</span><span class="identifier">async_wait</span><span class="special">(</span>
<span class="comment">// ...</span>
<span class="special">);</span>
</pre>
<p class="simpara">
<br> Note: for maximum flexibility, <code class="computeroutput"><span class="identifier">parallel_group</span></code>
does not propagate the executor automatically to the operations within
the group.
</p>
</li>
<li class="listitem">
<p class="simpara">
Added <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">promise</span></code>. The <code class="computeroutput"><span class="identifier">promise</span></code>
type allows eager execution and synchronisation of async operations. For
example:<br>
</p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="identifier">promise</span> <span class="special">=</span> <span class="identifier">async_read</span><span class="special">(</span>
<span class="identifier">stream</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">my_buffer</span><span class="special">),</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">use_promise</span><span class="special">);</span>
<span class="special">...</span> <span class="keyword">do</span> <span class="identifier">other</span> <span class="identifier">stuff</span> <span class="keyword">while</span> <span class="identifier">the</span> <span class="identifier">read</span> <span class="identifier">is</span> <span class="identifier">going</span> <span class="identifier">on</span> <span class="special">...</span>
<span class="identifier">promise</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span> <span class="comment">// completion the operation</span>
<span class="special">[](</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">bytes_read</span><span class="special">)</span>
<span class="special">{</span>
<span class="special">...</span>
<span class="special">});</span>
</pre>
<p class="simpara">
<br> Promises can be safely disregarded if the result is no longer required.
Different operations can be combined to either wait for all to complete
or for one to complete (and cancel the rest). For example, to wait for
one to complete:<br>
</p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="identifier">timeout_promise</span> <span class="special">=</span>
<span class="identifier">timer</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">use_promise</span><span class="special">);</span>
<span class="keyword">auto</span> <span class="identifier">read_promise</span> <span class="special">=</span> <span class="identifier">async_read</span><span class="special">(</span>
<span class="identifier">stream</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">my_buffer</span><span class="special">),</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">use_promise</span><span class="special">);</span>
<span class="keyword">auto</span> <span class="identifier">promise</span> <span class="special">=</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">promise</span><span class="special">&lt;&gt;::</span><span class="identifier">race</span><span class="special">(</span>
<span class="identifier">timeout_promise</span><span class="special">,</span> <span class="identifier">read_promise</span><span class="special">);</span>
<span class="identifier">promise</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span>
<span class="special">[](</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">variant</span><span class="special">&lt;</span><span class="identifier">error_code</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">tuple</span><span class="special">&lt;</span><span class="identifier">error_code</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">&gt;&gt;</span> <span class="identifier">v</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">if</span> <span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">index</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">)</span> <span class="special">{}</span> <span class="comment">//timed out</span>
<span class="keyword">else</span> <span class="keyword">if</span> <span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">index</span><span class="special">()</span> <span class="special">==</span> <span class="number">1</span><span class="special">)</span> <span class="comment">// completed in time</span>
<span class="special">});</span>
</pre>
<p class="simpara">
<br> or to wait for all to complete:<br>
</p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="identifier">write_promise</span> <span class="special">=</span> <span class="identifier">async_write</span><span class="special">(</span>
<span class="identifier">stream</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">my_write_buffer</span><span class="special">),</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">use_promise</span><span class="special">);</span>
<span class="keyword">auto</span> <span class="identifier">read_promise</span> <span class="special">=</span> <span class="identifier">async_read</span><span class="special">(</span>
<span class="identifier">stream</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">my_buffer</span><span class="special">),</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">use_promise</span><span class="special">);</span>
<span class="keyword">auto</span> <span class="identifier">promise</span> <span class="special">=</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">promise</span><span class="special">&lt;&gt;::</span><span class="identifier">all</span><span class="special">(</span>
<span class="identifier">write_promise</span><span class="special">,</span> <span class="identifier">read_promise</span><span class="special">);</span>
<span class="identifier">promise</span><span class="special">.</span><span class="identifier">async_wait</span><span class="special">(</span>
<span class="special">[](</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">tuple</span><span class="special">&lt;</span><span class="identifier">error_code</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">&gt;</span> <span class="identifier">write_result</span><span class="special">,</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">tuple</span><span class="special">&lt;</span><span class="identifier">error_code</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">&gt;</span> <span class="identifier">read_result</span><span class="special">)</span>
<span class="special">{</span>
<span class="special">});</span>
</pre>
<p class="simpara">
<br> Thanks go to Klemens Morgenstern for contributing this feature.
</p>
</li>
<li class="listitem">
<p class="simpara">
Added the <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">coro</span></code>
class template. The <code class="computeroutput"><span class="identifier">coro</span></code>
type is a C++20 coroutine primitive for resumable functions, with the ability
to combine both asynchronous waiting (<code class="computeroutput"><span class="identifier">co_await</span></code>)
and yielding (<code class="computeroutput"><span class="identifier">co_yield</span></code>)
into a single, stateful control flow. For example:<br>
</p>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">asio</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">asio</span><span class="special">/</span><span class="identifier">experimental</span><span class="special">/</span><span class="identifier">coro</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">;</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">coro</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&gt;</span> <span class="identifier">reader</span><span class="special">(</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">&amp;</span> <span class="identifier">sock</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">buf</span><span class="special">;</span>
<span class="keyword">while</span> <span class="special">(</span><span class="identifier">sock</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">())</span>
<span class="special">{</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">n</span> <span class="special">=</span> <span class="identifier">co_await</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">async_read_until</span><span class="special">(</span>
<span class="identifier">sock</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">dynamic_buffer</span><span class="special">(</span><span class="identifier">buf</span><span class="special">),</span> <span class="char">'\n'</span><span class="special">,</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">use_coro</span><span class="special">);</span>
<span class="identifier">co_yield</span> <span class="identifier">buf</span><span class="special">.</span><span class="identifier">substr</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="identifier">n</span><span class="special">);</span>
<span class="identifier">buf</span><span class="special">.</span><span class="identifier">erase</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="identifier">n</span><span class="special">);</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">awaitable</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">&gt;</span> <span class="identifier">consumer</span><span class="special">(</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">sock</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">auto</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">reader</span><span class="special">(</span><span class="identifier">sock</span><span class="special">);</span>
<span class="keyword">auto</span> <span class="identifier">msg1</span> <span class="special">=</span> <span class="identifier">co_await</span> <span class="identifier">r</span><span class="special">.</span><span class="identifier">async_resume</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">use_awaitable</span><span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Message 1: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">msg1</span><span class="special">.</span><span class="identifier">value_or</span><span class="special">(</span><span class="string">"\n"</span><span class="special">);</span>
<span class="keyword">auto</span> <span class="identifier">msg2</span> <span class="special">=</span> <span class="identifier">co_await</span> <span class="identifier">r</span><span class="special">.</span><span class="identifier">async_resume</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">use_awaitable</span><span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Message 2: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">msg2</span><span class="special">.</span><span class="identifier">value_or</span><span class="special">(</span><span class="string">"\n"</span><span class="special">);</span>
<span class="special">}</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">awaitable</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">&gt;</span> <span class="identifier">listen</span><span class="special">(</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">acceptor</span><span class="special">&amp;</span> <span class="identifier">acceptor</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">for</span> <span class="special">(;;)</span>
<span class="special">{</span>
<span class="identifier">co_spawn</span><span class="special">(</span>
<span class="identifier">acceptor</span><span class="special">.</span><span class="identifier">get_executor</span><span class="special">(),</span>
<span class="identifier">consumer</span><span class="special">(</span><span class="identifier">co_await</span> <span class="identifier">acceptor</span><span class="special">.</span><span class="identifier">async_accept</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">use_awaitable</span><span class="special">)),</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">detached</span><span class="special">);</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
<span class="special">{</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_context</span> <span class="identifier">ctx</span><span class="special">;</span>
<span class="identifier">tcp</span><span class="special">::</span><span class="identifier">acceptor</span> <span class="identifier">acceptor</span><span class="special">(</span><span class="identifier">ctx</span><span class="special">,</span> <span class="special">{</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">v4</span><span class="special">(),</span> <span class="number">54321</span><span class="special">});</span>
<span class="identifier">co_spawn</span><span class="special">(</span><span class="identifier">ctx</span><span class="special">,</span> <span class="identifier">listen</span><span class="special">(</span><span class="identifier">acceptor</span><span class="special">),</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">detached</span><span class="special">);</span>
<span class="identifier">ctx</span><span class="special">.</span><span class="identifier">run</span><span class="special">();</span>
<span class="special">}</span>
</pre>
<p class="simpara">
<br> Thanks go to Klemens Morgenstern for contributing this feature.
</p>
</li>
<li class="listitem">
Added move assignment to <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span><span class="special">&lt;&gt;</span></code>.
</li>
<li class="listitem">
Changed <code class="computeroutput"><span class="identifier">co_spawn</span></code> to <code class="computeroutput"><span class="identifier">dispatch</span></code> the coroutine's initial step
to the executor, and to only <code class="computeroutput"><span class="identifier">post</span></code>
the completion handler if the coroutine did not otherwise perform a context
switch (i.e. a <code class="computeroutput"><span class="identifier">co_await</span></code>
on an asynchronous operation).
</li>
<li class="listitem">
Enabled additional optimisations for <code class="computeroutput"><span class="identifier">any_executor</span></code>
and <code class="computeroutput"><span class="identifier">any_io_executor</span></code> when
used with asynchronous operations.
</li>
<li class="listitem">
Added the <code class="computeroutput"><span class="identifier">nodiscard</span></code> attribute
to <code class="computeroutput"><span class="identifier">awaitable</span><span class="special">&lt;&gt;</span></code>.
</li>
<li class="listitem">
Increased the number of cached slots in the default recycling allocator.
This number defaults to 2, but may also be specified by defining the <code class="computeroutput"><span class="identifier">ASIO_RECYCLING_ALLOCATOR_CACHE_SIZE</span></code> macro.
</li>
<li class="listitem">
Disabled the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">system_error</span></code> message workaround for recent
MSVC.
</li>
<li class="listitem">
Changed the default allocator behaviour to respect alignment requirements,
to support over-aligned types. Requires C++17 or later, or Boost.
</li>
<li class="listitem">
Ensured the result strings are always initialised in reverse name resolution.
</li>
<li class="listitem">
Fixed recursive template instantiation issues in <code class="computeroutput"><span class="identifier">use_awaitable_t</span><span class="special">::</span><span class="identifier">executor_with_default</span></code>.
</li>
<li class="listitem">
Fixed the <code class="computeroutput"><span class="identifier">any_io_executor</span></code>
equality operators to correctly return a result based on the target executor.
</li>
</ul></div>
<h4>
<a name="asio.history.h15"></a>
<span><a name="asio.history.asio_1_18_2"></a></span><a class="link" href="history.html#asio.history.asio_1_18_2">Asio
1.18.2</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">scope_id_type</span></code> type alias.
</li>
<li class="listitem">
Added <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">port_type</span></code> type alias.
</li>
<li class="listitem">
Added <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">hash</span></code> specialisations for IP addresses.
</li>
<li class="listitem">
Added <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">hash</span></code> specialisations for <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_endpoint</span><span class="special">&lt;&gt;</span></code>.
</li>
<li class="listitem">
Refactored SFINAE usage to improve compile times.
</li>
<li class="listitem">
Added friendship support to customisation points, and made most customisations
private.
</li>
<li class="listitem">
Changed <code class="computeroutput"><span class="identifier">any_io_executor</span></code>
to a "strong typedef"-style class.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">as_single</span></code> to work with handler hook deprecation.
</li>
<li class="listitem">
Ensured pthread condition variable attributes are cleaned up on all platforms.
</li>
<li class="listitem">
Clarified thread safety notes on sockets and descriptors.
</li>
<li class="listitem">
Ensured <code class="computeroutput"><span class="identifier">errno</span></code> is not overwritten
if <code class="computeroutput"><span class="identifier">socket</span><span class="special">()</span></code>
fails on macOS/FreeBSD.
</li>
<li class="listitem">
Fixed work tracking for <code class="computeroutput"><span class="identifier">io_context</span></code>
and <code class="computeroutput"><span class="identifier">thread_pool</span></code> executors
when move-assigned.
</li>
<li class="listitem">
Ensured internal <code class="computeroutput"><span class="identifier">call_stack</span></code>
objects are accessed only from implementation files.
</li>
<li class="listitem">
Fixed I/O object move-assignment to ensure the executor is left in a valid
state.
</li>
<li class="listitem">
Fixed detection of compiler support for defaulted template argument on
functions with MSVC.
</li>
<li class="listitem">
Prevented the <code class="computeroutput"><span class="identifier">blocking</span><span class="special">.</span><span class="identifier">always</span></code>
property from being used with <code class="computeroutput"><span class="identifier">strand</span><span class="special">&lt;&gt;</span></code>, as it did not produce the correct
semantics.
</li>
<li class="listitem">
Removed deprecated file <code class="literal">asio/impl/src.cpp</code>.
</li>
</ul></div>
<h4>
<a name="asio.history.h16"></a>
<span><a name="asio.history.asio_1_18_1"></a></span><a class="link" href="history.html#asio.history.asio_1_18_1">Asio
1.18.1</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Enabled support for UNIX domain sockets on Windows. From Windows 10, UNIX
domain sockets (a.k.a "local" sockets) are supported on Windows,
with the exception of the <code class="computeroutput"><span class="identifier">connect_pair</span></code>
function (which will fail with an operation_not_supported error).
</li>
<li class="listitem">
Added executor-converting construction and assignment to <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_resolver</span></code>.
</li>
<li class="listitem">
Added compatibility between polymorphic executors and the (deprecated)
handler invocation hook.
</li>
<li class="listitem">
<p class="simpara">
Added the <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">as_single</span></code>
completion token adapter. The <code class="computeroutput"><span class="identifier">as_single</span></code>
completion token adapter can be used to specify that the completion handler
arguments should be combined into a single argument. For completion signatures
with a single parameter, the argument is passed through as-is. For signatures
with two or more parameters, the arguments are combined into a tuple. The
<code class="computeroutput"><span class="identifier">as_single</span></code> adapter may be
used in conjunction with <code class="computeroutput"><span class="identifier">use_awaitable</span></code>
and structured bindings as follows:<br>
</p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="special">[</span><span class="identifier">e</span><span class="special">,</span> <span class="identifier">n</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">co_await</span> <span class="identifier">socket</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">data</span><span class="special">),</span> <span class="identifier">as_single</span><span class="special">(</span><span class="identifier">use_awaitable</span><span class="special">));</span>
</pre>
<p class="simpara">
<br> Alternatively, it may be used as a default completion token like
so:<br>
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">default_token</span> <span class="special">=</span> <span class="identifier">as_single_t</span><span class="special">&lt;</span><span class="identifier">use_awaitable_t</span><span class="special">&lt;&gt;&gt;;</span>
<span class="keyword">using</span> <span class="identifier">tcp_socket</span> <span class="special">=</span> <span class="identifier">default_token</span><span class="special">::</span><span class="identifier">as_default_on_t</span><span class="special">&lt;</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">&gt;;</span>
<span class="comment">// ...</span>
<span class="identifier">awaitable</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">&gt;</span> <span class="identifier">do_read</span><span class="special">(</span><span class="identifier">tcp_socket</span> <span class="identifier">socket</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// ...</span>
<span class="keyword">auto</span> <span class="special">[</span><span class="identifier">e</span><span class="special">,</span> <span class="identifier">n</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">co_await</span> <span class="identifier">socket</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">data</span><span class="special">));</span>
<span class="comment">// ...</span>
<span class="special">}</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
Added support for <code class="computeroutput"><span class="identifier">MSG_NOSIGNAL</span></code>
on more platforms by using <code class="computeroutput"><span class="identifier">_POSIX_VERSION</span></code>
to detect whether it is supported.
</li>
<li class="listitem">
Added the ability to compile using libpthread on Windows.
</li>
<li class="listitem">
Added workarounds for the Intel C++ compiler.
</li>
<li class="listitem">
Added more support for detecting and optimising for handlers that have
no custom executor.
</li>
<li class="listitem">
Reduced lock contention for timer cancellation on Windows.
</li>
<li class="listitem">
Reinstated a previously removed null-pointer check, as it had a measurable
impact on performance.
</li>
<li class="listitem">
Fixed the <code class="computeroutput"><span class="identifier">executor</span></code> concept
to test for a const-qualified <code class="computeroutput"><span class="identifier">execute</span><span class="special">()</span></code>.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">any_executor</span></code> support
for builds without RTTI support.
</li>
<li class="listitem">
Fixed the <code class="computeroutput"><span class="identifier">thread_pool</span></code> unit
test to work without RTTI support.
</li>
<li class="listitem">
Fixed C++20 coroutines compatibility with clang on Windows.
</li>
<li class="listitem">
Fixed some compatibility issues with Windows Runtime.
</li>
<li class="listitem">
Fixed shadow name warnings caused by addition of <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">query</span></code>.
</li>
<li class="listitem">
Fixed a "logical or of equal expressions" warning on linux.
</li>
<li class="listitem">
Fixed a benign switch fallthrough warning.
</li>
<li class="listitem">
Added missing <code class="computeroutput"><span class="identifier">push</span><span class="special">/</span><span class="identifier">pop_options</span><span class="special">.</span><span class="identifier">hpp</span></code> includes.
</li>
<li class="listitem">
Suppressed zero-as-null-pointer-constant warnings.
</li>
<li class="listitem">
Fixed a comma-operator warning.
</li>
<li class="listitem">
Updated the documentation to clarify when the <code class="literal">select</code>
reactor is used on Windows.
</li>
<li class="listitem">
Fixed potential ambiguity caused by <code class="computeroutput"><span class="identifier">any_executor</span></code>
comparisons and conversion.
</li>
<li class="listitem">
Added detection of non-experimental C++20 coroutines on MSVC 19.8.
</li>
<li class="listitem">
Fixed compatibility with uClibc.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">strand</span><span class="special">&lt;&gt;</span></code>
adaptation of Networking TS executors when targeting older C++ versions
or less conformant compilers.
</li>
</ul></div>
<h4>
<a name="asio.history.h17"></a>
<span><a name="asio.history.asio_1_18_0"></a></span><a class="link" href="history.html#asio.history.asio_1_18_0">Asio
1.18.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Marked the <code class="computeroutput"><span class="identifier">basic_socket_acceptor</span></code>
move constructor as <code class="computeroutput"><span class="keyword">noexcept</span></code>.
</li>
<li class="listitem">
Added workarounds for various issues in <code class="literal">gcc</code> 10's coroutine
support.
</li>
<li class="listitem">
Added standard executor support to <code class="computeroutput"><span class="identifier">windows</span><span class="special">::</span><span class="identifier">overlapped_ptr</span></code>.
</li>
<li class="listitem">
Added missing compatibility macros for the <code class="computeroutput"><span class="identifier">execution</span><span class="special">::</span><span class="identifier">receiver_of</span></code>
concept.
</li>
<li class="listitem">
Added short-circuited evaluation to <code class="computeroutput"><span class="identifier">execution</span><span class="special">::</span><span class="identifier">executor</span></code>,
<code class="computeroutput"><span class="identifier">execution</span><span class="special">::</span><span class="identifier">operation_state</span></code>,<code class="computeroutput"><span class="identifier">execution</span><span class="special">::</span><span class="identifier">sender</span></code>,
<code class="computeroutput"><span class="identifier">execution</span><span class="special">::</span><span class="identifier">receiver</span></code>, <code class="computeroutput"><span class="identifier">execution</span><span class="special">::</span><span class="identifier">receiver_of</span></code>,
and <code class="computeroutput"><span class="identifier">execution</span><span class="special">::</span><span class="identifier">scheduler</span></code> concepts and the corresponding
traits. These now test first for well-formed CPO expressions (or, in the
case of senders, a specialised <code class="computeroutput"><span class="identifier">sender_traits</span></code>
template) and, if not valid, short-circuit the remainder of the evaluation.
This helps prevent recursive template instantiations that can occur in
some contexts.
</li>
<li class="listitem">
Added constraints to the <code class="computeroutput"><span class="identifier">strand</span></code>
template's constructor, to prevent template instantiation recursion.
</li>
<li class="listitem">
Changed Asio's internal executor adapters to prevent template instantiation
recursion.
</li>
<li class="listitem">
Added constraints to the <code class="computeroutput"><span class="identifier">execution</span><span class="special">::</span><span class="identifier">any_executor</span></code>
template's converting constructors, as per the specification.
</li>
<li class="listitem">
Added missing <code class="computeroutput"><span class="identifier">execution</span><span class="special">::</span><span class="identifier">sender_traits</span></code>
specialisation and <code class="computeroutput"><span class="identifier">connect</span><span class="special">()</span></code> member function to the <code class="computeroutput"><span class="identifier">thread_pool</span></code> executor, as per the specification.
</li>
<li class="listitem">
Changed <code class="computeroutput"><span class="identifier">execution</span><span class="special">::</span><span class="identifier">blocking_t</span><span class="special">::</span><span class="identifier">always_t</span><span class="special">::</span><span class="identifier">is_preferable</span></code> to be false as per the
specification.
</li>
<li class="listitem">
Added <code class="computeroutput"><span class="identifier">shape_type</span></code> and <code class="computeroutput"><span class="identifier">index_type</span></code> to <code class="computeroutput"><span class="identifier">thread_pool</span></code>
executors, as per the specification.
</li>
<li class="listitem">
Ensured that the standard executor concept-related traits (such as <code class="computeroutput"><span class="identifier">execution</span><span class="special">::</span><span class="identifier">is_executor</span></code>) work with <code class="computeroutput"><span class="keyword">void</span></code>.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">async_compose</span></code> support
for standard executors.
</li>
<li class="listitem">
Fixed the forward declaration of <code class="computeroutput"><span class="identifier">any_io_executor</span></code>
in <code class="literal">asio/ts/netfwd.hpp</code>.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">use_future</span></code> compatibility
with older compilers.
</li>
<li class="listitem">
Fixed compatibility with MinGW.
</li>
<li class="listitem">
Improved compatibility with older versions of <code class="literal">gcc</code>.
</li>
<li class="listitem">
Added compatiblity with <code class="literal">clang-cl</code> on Windows.
</li>
<li class="listitem">
Fixed various compiler warnings.
</li>
<li class="listitem">
Added basic overview documentation for the standard executors support.
</li>
<li class="listitem">
Added detailed descriptions to the standard executor-related member functions
of <code class="computeroutput"><span class="identifier">io_context</span></code> executors,
<code class="computeroutput"><span class="identifier">thread_pool</span></code> executors,
<code class="computeroutput"><span class="identifier">system_executor</span></code>, and <code class="computeroutput"><span class="identifier">strand</span><span class="special">&lt;&gt;</span></code>.
</li>
<li class="listitem">
Changed introductory documentation to reflect that there our now multiple
types of I/O execution context.
</li>
<li class="listitem">
Marked constructors, destructors, and static data members in class synopses
in the reference documentation.
</li>
<li class="listitem">
Fixed various minor documentation errors.
</li>
</ul></div>
<h4>
<a name="asio.history.h18"></a>
<span><a name="asio.history.asio_1_17_0"></a></span><a class="link" href="history.html#asio.history.asio_1_17_0">Asio
1.17.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added an implementation of the proposed standard executors (<a href="http://wg21.link/P0443r13" target="_top">P0443r13</a>,
<a href="http://wg21.link/P1348r0" target="_top">P1348r0</a>, and <a href="http://wg21.link/P1393r0" target="_top">P1393r0</a>).
</li>
<li class="listitem">
Added support for the proposed standard executors to Asio's I/O facilities:
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
The <code class="computeroutput"><span class="identifier">io_context</span><span class="special">::</span><span class="identifier">executor_type</span></code>, <code class="computeroutput"><span class="identifier">thread_pool</span><span class="special">::</span><span class="identifier">executor_type</span></code>,
<code class="computeroutput"><span class="identifier">system_executor</span></code>,
and <code class="computeroutput"><span class="identifier">strand</span></code> executors
now meet the requirements for the proposed standard executors. These
classes also continue to meet the existing requirements for the Networking
TS model of executors.
</li>
<li class="listitem">
All I/O objects, asynchronous operations, and utilities including
<code class="computeroutput"><span class="identifier">dispatch</span></code>, <code class="computeroutput"><span class="identifier">post</span></code>, <code class="computeroutput"><span class="identifier">defer</span></code>,
<code class="computeroutput"><span class="identifier">get_associated_executor</span></code>,
<code class="computeroutput"><span class="identifier">bind_executor</span></code>, <code class="computeroutput"><span class="identifier">make_work_guard</span></code>, <code class="computeroutput"><span class="identifier">spawn</span></code>, <code class="computeroutput"><span class="identifier">co_spawn</span></code>,
<code class="computeroutput"><span class="identifier">async_compose</span></code>, <code class="computeroutput"><span class="identifier">use_future</span></code>, etc., can interoperate
with both new proposed standard executors, and with existing Networking
TS executors. The implementation determines at compile time which
model a particular executor meets; the proposed standard executor
model is used in preference if both are detected.
</li>
<li class="listitem">
The <code class="computeroutput"><span class="identifier">any_io_executor</span></code>
type alias has been introduced as the new default runtime-polymorphic
executor for all I/O objects. This type alias points to the <code class="computeroutput"><span class="identifier">execution</span><span class="special">::</span><span class="identifier">any_executor</span><span class="special">&lt;&gt;</span></code>
template with a set of supportable properties specified for use with
I/O. This change may break existing code that directly uses the old
polymorphic wrapper, <code class="computeroutput"><span class="identifier">executor</span></code>.
If required for backward compatibility, <code class="computeroutput"><span class="identifier">ASIO_USE_TS_EXECUTOR_AS_DEFAULT</span></code>
can be defined, which changes the <code class="computeroutput"><span class="identifier">any_io_executor</span></code>
type alias to instead point to the <code class="computeroutput"><span class="identifier">executor</span></code>
polymorphic wrapper.
</li>
<li class="listitem">
Support for the existing Networking TS model of executors can be
disabled by defining <code class="computeroutput"><span class="identifier">ASIO_NO_TS_EXECUTORS</span></code>.
</li>
</ul></div>
</li>
<li class="listitem">
<p class="simpara">
Added converting move construction and assignment to <code class="computeroutput"><span class="identifier">basic_waitable_timer</span></code>.
This enables move construction and assignment between different timer types,
provided the executor types are convertible. For example:<br>
</p>
<pre class="programlisting"><span class="identifier">basic_waitable_timer</span><span class="special">&lt;</span>
<span class="identifier">clock_type</span><span class="special">,</span>
<span class="identifier">traits_type</span><span class="special">,</span>
<span class="identifier">io_context</span><span class="special">::</span><span class="identifier">executor_type</span>
<span class="special">&gt;</span> <span class="identifier">timer1</span><span class="special">(</span><span class="identifier">my_io_context</span><span class="special">);</span>
<span class="identifier">basic_waitable_timer</span><span class="special">&lt;</span>
<span class="identifier">clock_type</span><span class="special">,</span>
<span class="identifier">traits_type</span><span class="special">,</span>
<span class="identifier">any_io_executor</span> <span class="comment">// polymorphic wrapper</span>
<span class="special">&gt;</span> <span class="identifier">timer2</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">timer1</span><span class="special">));</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
Enabled C++20 coroutine support when using <code class="literal">gcc</code> 10.
</li>
<li class="listitem">
<p class="simpara">
Added overloads of <code class="computeroutput"><span class="identifier">co_spawn</span></code>
that launch an awaitable. This change allows us to write:<br>
</p>
<pre class="programlisting"><span class="identifier">co_spawn</span><span class="special">(</span><span class="identifier">executor</span><span class="special">,</span>
<span class="identifier">echo</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">socket</span><span class="special">)),</span>
<span class="identifier">detached</span><span class="special">);</span>
</pre>
<p class="simpara">
<br> instead of:<br>
</p>
<pre class="programlisting"><span class="identifier">co_spawn</span><span class="special">(</span><span class="identifier">executor</span><span class="special">,</span>
<span class="special">[</span><span class="identifier">socket</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">socket</span><span class="special">)]()</span> <span class="keyword">mutable</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">echo</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">socket</span><span class="special">));</span>
<span class="special">},</span>
<span class="identifier">detached</span><span class="special">);</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
Added a new constructor overload to <code class="computeroutput"><span class="identifier">use_awaitable_t</span></code>'s
default executor adapter, to enable conversion between executor types.
</li>
<li class="listitem">
Added support for using <code class="computeroutput"><span class="identifier">detached_t</span></code>
as a default completion token, by adding members <code class="computeroutput"><span class="identifier">as_default_on</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">as_default_on_t</span><span class="special">&lt;&gt;</span></code>.
</li>
<li class="listitem">
Added a move constructor to <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span><span class="special">&lt;&gt;</span></code>.
</li>
<li class="listitem">
Changed <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span><span class="special">&lt;&gt;</span></code>
write operations to linearise gather-write buffer sequences.
</li>
<li class="listitem">
Added compile-time detection of the deprecated <code class="computeroutput"><span class="identifier">asio_handler_invoke</span></code>
hook. This hook was deprecated with the introduction of the Networking
TS trait <code class="computeroutput"><span class="identifier">associated_executor</span></code>
and function <code class="computeroutput"><span class="identifier">get_associated_executor</span><span class="special">()</span></code>. Compiling an application with <code class="computeroutput"><span class="identifier">ASIO_NO_DEPRECATED</span></code> will now trigger a
compile error if any handler implements the <code class="computeroutput"><span class="identifier">asio_handler_invoke</span></code>
hook.
</li>
<li class="listitem">
Added compile-time detection of the deprecated <code class="computeroutput"><span class="identifier">asio_handler_allocate</span></code>
and <code class="computeroutput"><span class="identifier">asio_handle_deallocate</span></code>
hooks. These hooks were deprecated with the introduction of the Networking
TS trait <code class="computeroutput"><span class="identifier">associated_allocator</span></code>
and function <code class="computeroutput"><span class="identifier">get_associated_allocator</span><span class="special">()</span></code>. Compiling an application with <code class="computeroutput"><span class="identifier">ASIO_NO_DEPRECATED</span></code> will now trigger a
compile error if any handler implements the <code class="computeroutput"><span class="identifier">asio_handler_allocate</span></code>
or <code class="computeroutput"><span class="identifier">asio_handler_deallocate</span></code>
hooks.
</li>
<li class="listitem">
Implemented a number of performance optimisations, including:
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
Specialising single-buffer operations to use <code class="computeroutput"><span class="identifier">recv</span></code>
rather than <code class="computeroutput"><span class="identifier">recvmsg</span></code>,
<code class="computeroutput"><span class="identifier">send</span></code> rather than
<code class="computeroutput"><span class="identifier">sendmsg</span></code>, <code class="computeroutput"><span class="identifier">read</span></code> rather than <code class="computeroutput"><span class="identifier">readv</span></code>, and <code class="computeroutput"><span class="identifier">write</span></code>
rather than <code class="computeroutput"><span class="identifier">writev</span></code>.
</li>
<li class="listitem">
Lightening the reference counting overhead of the polymorphic wrapper
<code class="computeroutput"><span class="identifier">executor</span></code>.
</li>
<li class="listitem">
Returning from system call operation wrappers as early as possible,
and only accessing <code class="computeroutput"><span class="identifier">errno</span></code>
and error codes when on an error path.
</li>
<li class="listitem">
Applying additional optimisations if a "native" I/O executor
(such as <code class="computeroutput"><span class="identifier">io_context</span><span class="special">::</span><span class="identifier">exeutor_type</span></code>)
is detected.
</li>
</ul></div>
</li>
<li class="listitem">
<p class="simpara">
Added source location support to handler tracking. The new <code class="computeroutput"><span class="identifier">ASIO_HANDLER_LOCATION</span><span class="special">((</span><span class="identifier">file_name</span><span class="special">,</span>
<span class="identifier">line</span><span class="special">,</span>
<span class="identifier">function_name</span><span class="special">))</span></code>
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. Then,
when an asynchronous operation is launched with location information, it
outputs lines using the <span class="bold"><strong>&lt;action&gt;</strong></span>
<code class="literal">n^m</code>, prior to the <code class="literal">n*m</code> line that signifies
the beginning of the asynchronous operation. For example:
</p>
<pre class="programlisting"> @asio|1589423304.861944|&gt;7|ec=system:0,bytes_transferred=5
@asio|1589423304.861952|7^8|in 'async_write' (.<span class="emphasis"><em>..</em></span>../../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|&lt;7|</pre>
<p class="simpara">
<br> If <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">source_location</span></code> or <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">source_location</span></code>
are available, the <code class="computeroutput"><span class="identifier">use_awaitable_t</span></code>
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 <code class="computeroutput"><span class="identifier">use_awaitable_t</span></code>
object may also be explicitly constructed with location information.
</p>
</li>
<li class="listitem">
Implemented various improvements to the <code class="literal">handlerviz.pl</code>
tool.
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
Add nodes for pending handlers at bottom of graph, outlined in red.
</li>
<li class="listitem">
Display source location in a tooltip on the edge label (for SVG).
</li>
<li class="listitem">
Use invisible nodes to enforce order to keep related control flow
vertical.
</li>
</ul></div>
</li>
<li class="listitem">
<p class="simpara">
Added the <code class="literal">handlerlive.pl</code> tool, which processes handler
tracking output to produce a list of "live" handlers. Live handlers
are those that are associated with pending asynchronous operations, as
well as handlers that are currently executing. For example:
</p>
<pre class="programlisting"><span class="identifier">cat</span> <span class="identifier">output</span><span class="special">.</span><span class="identifier">txt</span> <span class="special">|</span> <span class="identifier">perl</span> <span class="identifier">handlerlive</span><span class="special">.</span><span class="identifier">pl</span>
</pre>
<p class="simpara">
or:
</p>
<pre class="programlisting"><span class="identifier">perl</span> <span class="identifier">handerlive</span><span class="special">.</span><span class="identifier">pl</span> <span class="special">&lt;</span> <span class="identifier">output</span><span class="special">.</span><span class="identifier">txt</span>
</pre>
<p class="simpara">
or:
</p>
<pre class="programlisting"><span class="identifier">perl</span> <span class="identifier">handlerlive</span><span class="special">.</span><span class="identifier">pl</span> <span class="identifier">output</span><span class="special">.</span><span class="identifier">txt</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
<p class="simpara">
Added the <code class="literal">handlertree.pl</code> tool, which 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 <code class="computeroutput"><span class="number">123</span></code>,
<code class="computeroutput"><span class="number">456</span></code>, and their predecessors:
</p>
<pre class="programlisting"> cat output.txt | perl handlertree.pl 123 456</pre>
<p class="simpara">
or:
</p>
<pre class="programlisting"> perl handlertree.pl 123 456 &lt; output.txt</pre>
<p class="simpara">
<br> This script may be combined with handerlive.pl and handlerviz.pl
to produce a graph of the "live" asynchronous operation chains.
For example:
</p>
<pre class="programlisting"> cat output.txt | \
perl handlertree.pl <code class="computeroutput"><span class="identifier">perl</span> <span class="identifier">handlerlive</span><span class="special">.</span><span class="identifier">pl</span> <span class="identifier">output</span><span class="special">.</span><span class="identifier">txt</span></code> | \
perl handlerviz.pl | \
dot -Tsvg &gt; output.svg</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
Added changes for clang-based Embarcadero C++ compilers.
</li>
<li class="listitem">
Fixed a deadlock that can occur when multiple threads concurrently initialise
the Windows I/O completion port backend.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">async_compose</span></code> to
work with copyable handlers when passed by lvalue.
</li>
<li class="listitem">
Fixed completion signature deduction in <code class="computeroutput"><span class="identifier">co_spawn</span></code>.
</li>
<li class="listitem">
Removed a spurious <code class="computeroutput"><span class="identifier">Executor</span></code>
base class from the <code class="computeroutput"><span class="identifier">executor_binder</span></code>
implementation.
</li>
<li class="listitem">
Various fixes and improvements in the documentation and examples.
</li>
</ul></div>
<h4>
<a name="asio.history.h19"></a>
<span><a name="asio.history.asio_1_16_1"></a></span><a class="link" href="history.html#asio.history.asio_1_16_1">Asio
1.16.1</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Fixed compatibility with C++20 concept syntax.
</li>
<li class="listitem">
Marked the POSIX descriptor classes' move constructors as <code class="computeroutput"><span class="keyword">noexcept</span></code>.
</li>
<li class="listitem">
Added the <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">host_name_verification</span></code> class, which is
a drop-in replacement for <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">rfc2818_verification</span></code>.
The <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">rfc2818_verification</span></code> class has been marked
as deprecated. As a consequence of this change, SSL support now depends
on functions that were introduced in OpenSSL 1.0.2.
</li>
<li class="listitem">
Added an <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">context</span></code> constructor to take ownership
of a native handle.
</li>
<li class="listitem">
Changed C++ language version detection with <code class="literal">gcc</code> to use
<code class="computeroutput"><span class="identifier">__cplusplus</span></code> macro.
</li>
<li class="listitem">
Fixed a work counting issue in the asynchronous resolve operation for endpoints.
</li>
<li class="listitem">
Fixed the <code class="computeroutput"><span class="identifier">strand</span><span class="special">&lt;&gt;</span></code>
converting constructors and assignment operators.
</li>
<li class="listitem">
Ensured that resolvers are restarted correctly after a fork.
</li>
<li class="listitem">
Fixed compatibility with the current NetBSD release.
</li>
<li class="listitem">
Removed spurious handler requirement checks in some <code class="computeroutput"><span class="identifier">async_read</span></code>
overloads.
</li>
<li class="listitem">
Changed the <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">context</span></code> class to propagate non-EOF errors
from the <code class="computeroutput"><span class="identifier">add_certificate_authority</span></code>
function.
</li>
<li class="listitem">
Fixed a Windows-specific <code class="computeroutput"><span class="identifier">thread_pool</span></code>
destructor hang that occurred when the pool had an associated I/O object.
</li>
<li class="listitem">
Changed the <code class="literal">select</code> reactor to recreate the "self
pipe trick" sockets on error. This addresses an issue on some versions
of Windows, where these sockets are discconected after a system sleep.
</li>
<li class="listitem">
Fixed a compile error in the buffered streams due to the lack of reference
collapsing in C++98.
</li>
<li class="listitem">
Changed the <code class="computeroutput"><span class="identifier">priority_scheduler</span></code>
example to demonstrate calls to <code class="computeroutput"><span class="identifier">shutdown</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">destroy</span><span class="special">()</span></code>.
</li>
<li class="listitem">
Removed some unnecessary null pointer checks.
</li>
<li class="listitem">
Changed Windows platform detection to recognise TV titles as Windows apps.
</li>
<li class="listitem">
Added some emscripten compatibility patches.
</li>
<li class="listitem">
Fixed a compile error in the <code class="computeroutput"><span class="identifier">use_awaitable_t</span><span class="special">::</span><span class="identifier">as_default_on</span></code>
function.
</li>
<li class="listitem">
Changed all uses of the boost.bind placeholders to use the <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">placeholders</span></code> namespace.
</li>
<li class="listitem">
Fixed a potential compile error in the <code class="computeroutput"><span class="identifier">async_compose</span></code>
implementation due to incorrect overload selection.
</li>
<li class="listitem">
Suppressed some non-virtual destructor warnings.
</li>
<li class="listitem">
Various documentation fixes and improvements.
</li>
</ul></div>
<h4>
<a name="asio.history.h20"></a>
<span><a name="asio.history.asio_1_16_0"></a></span><a class="link" href="history.html#asio.history.asio_1_16_0">Asio
1.16.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Changed the <code class="computeroutput"><span class="identifier">async_initiate</span></code>
helper function to automatically deduce its return type. This is enabled
for C++11 or later.
</li>
<li class="listitem">
Changed all asynchronous operations to use automatically deduced return
types. This allows completion token implementations to incorporate the
asynchronous operation initiation into the initiating function's return
type, without type erasure. Note that C++14 or later is required to support
completion tokens that use per-operation return type deduction. For C++11
or earlier, a completion token's async_result specialisation must still
provide the nested typedef <code class="computeroutput"><span class="identifier">return_type</span></code>.
</li>
<li class="listitem">
Introduced three new concepts to support <code class="computeroutput"><span class="identifier">async_initiate</span></code>.
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
<code class="computeroutput"><span class="identifier">completion_signature</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;</span></code>: Checks if <code class="computeroutput"><span class="identifier">T</span></code>
is a signature of the form <code class="computeroutput"><span class="identifier">R</span><span class="special">(</span><span class="identifier">Args</span><span class="special">...)</span></code>.
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">completion_handler_for</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Signature</span><span class="special">&gt;</span></code>: Checks if <code class="computeroutput"><span class="identifier">T</span></code>
is usable as a completion handler with the specified signature.
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">completion_token_for</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Signature</span><span class="special">&gt;</span></code>: Checks if <code class="computeroutput"><span class="identifier">T</span></code>
is a completion token that can be used with async_initiate and the
specified signature.
</li>
<li class="listitem">
For backward compatibility with pre-concepts C++, the macros <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_COMPLETION_SIGNATURE</span></code>,
<code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_COMPLETION_HANDLER_FOR</span></code>,
and <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_COMPLETION_TOKEN_FOR</span></code>
are provided. These macros expand to <code class="computeroutput"><span class="keyword">typename</span></code>
when concepts are unsupported.
</li>
</ul></div>
</li>
<li class="listitem">
<p class="simpara">
Added the nested template type <code class="computeroutput"><span class="identifier">rebind_executor</span></code>
to all I/O object types, as a way to generically rebind them to use alternative
I/O executors. For example:
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">my_socket_type</span> <span class="special">=</span> <span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">::</span><span class="identifier">rebind_executor</span><span class="special">&lt;</span><span class="identifier">my_executor_type</span><span class="special">&gt;::</span><span class="identifier">other</span><span class="special">;</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
Changed the asynchronous operations' initiation function objects to report
their associated I/O executor via the nested type <code class="computeroutput"><span class="identifier">executor_type</span></code>
and member function <code class="computeroutput"><span class="identifier">get_executor</span><span class="special">()</span></code>. Note that the presence of <code class="computeroutput"><span class="identifier">executor_type</span></code> and <code class="computeroutput"><span class="identifier">get_executor</span><span class="special">()</span></code> should be treated as optional, and consequently
it may be preferable to access them via the <code class="computeroutput"><span class="identifier">associated_executor</span></code>
trait and the <code class="computeroutput"><span class="identifier">get_associated_executor</span><span class="special">()</span></code> helper function.
</li>
<li class="listitem">
<p class="simpara">
Added the <code class="computeroutput"><span class="identifier">default_completion_token</span></code>
trait, so that every I/O executor type now has an associated default completion
token type. This trait may be used in asynchronous operation declarations
as follows:
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span>
<span class="keyword">typename</span> <span class="identifier">IoObject</span><span class="special">,</span>
<span class="keyword">typename</span> <span class="identifier">CompletionToken</span> <span class="special">=</span>
<span class="keyword">typename</span> <span class="identifier">default_completion_token</span><span class="special">&lt;</span>
<span class="keyword">typename</span> <span class="identifier">IoObject</span><span class="special">::</span><span class="identifier">executor_type</span>
<span class="special">&gt;::</span><span class="identifier">type</span>
<span class="special">&gt;</span>
<span class="keyword">auto</span> <span class="identifier">async_xyz</span><span class="special">(</span>
<span class="identifier">IoObject</span><span class="special">&amp;</span> <span class="identifier">io_object</span><span class="special">,</span>
<span class="identifier">CompletionToken</span><span class="special">&amp;&amp;</span> <span class="identifier">token</span> <span class="special">=</span>
<span class="keyword">typename</span> <span class="identifier">default_completion_token</span><span class="special">&lt;</span>
<span class="keyword">typename</span> <span class="identifier">IoObject</span><span class="special">::</span><span class="identifier">executor_type</span>
<span class="special">&gt;::</span><span class="identifier">type</span><span class="special">{}</span>
<span class="special">);</span>
</pre>
<p class="simpara">
<br> If not specialised, this trait type is <code class="computeroutput"><span class="keyword">void</span></code>,
meaning no default completion token type is available for the given I/O
executor.
</p>
</li>
<li class="listitem">
<p class="simpara">
Specialised the <code class="computeroutput"><span class="identifier">default_completion_token</span></code>
trait for the <code class="computeroutput"><span class="identifier">use_awaitable</span></code>
completion token, so that it may be used as shown in the following example:
</p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="identifier">socket</span> <span class="special">=</span> <span class="identifier">use_awaitable</span><span class="special">.</span><span class="identifier">as_default_on</span><span class="special">(</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">(</span><span class="identifier">my_context</span><span class="special">));</span>
<span class="comment">// ...</span>
<span class="identifier">co_await</span> <span class="identifier">socket</span><span class="special">.</span><span class="identifier">async_connect</span><span class="special">(</span><span class="identifier">my_endpoint</span><span class="special">);</span> <span class="comment">// Defaults to use_awaitable.</span>
</pre>
<p class="simpara">
<br> In this example, the type of the <code class="computeroutput"><span class="identifier">socket</span></code>
object is transformed from <code class="computeroutput"><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span></code>
to have an I/O executor with the default completion token set to <code class="computeroutput"><span class="identifier">use_awaitable</span></code>. Alternatively, the socket
type may be computed directly:
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">tcp_socket</span> <span class="special">=</span> <span class="identifier">use_awaitable_t</span><span class="special">&lt;&gt;::</span><span class="identifier">as_default_on_t</span><span class="special">&lt;</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">&gt;;</span>
<span class="identifier">tcp_socket</span> <span class="identifier">socket</span><span class="special">(</span><span class="identifier">my_context</span><span class="special">);</span>
<span class="comment">// ...</span>
<span class="identifier">co_await</span> <span class="identifier">socket</span><span class="special">.</span><span class="identifier">async_connect</span><span class="special">(</span><span class="identifier">my_endpoint</span><span class="special">);</span> <span class="comment">// Defaults to use_awaitable.</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
Added missing <code class="computeroutput"><span class="identifier">async_initiate</span></code>
to the Windows-specific I/O objects' asynchronous operations.
</li>
<li class="listitem">
<p class="simpara">
Ensured that the executor type is propagated to newly accepted sockets.
When synchronously or asynchronously accepting a new connection, but without
specifying an executor or execution context, the accept operation will
now correctly propagate the executor type from the acceptor to the socket.
For example, if your acceptor type is:
</p>
<pre class="programlisting"><span class="identifier">basic_socket_acceptor</span><span class="special">&lt;</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">,</span> <span class="identifier">my_executor_type</span><span class="special">&gt;</span>
</pre>
<p class="simpara">
<br> then your accepted socket type will be:
</p>
<pre class="programlisting"><span class="identifier">basic_stream_socket</span><span class="special">&lt;</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">,</span> <span class="identifier">my_executor_type</span><span class="special">&gt;</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
Changed to require that <code class="computeroutput"><span class="identifier">Protocol</span></code>
copy and move operations never throw.
</li>
<li class="listitem">
Changed to require that <code class="computeroutput"><span class="identifier">Endpoint</span></code>
default constructor and move operations never throw.
</li>
<li class="listitem">
Added the <code class="computeroutput"><span class="keyword">noexcept</span></code> qualifier
to protocol accessors.
</li>
<li class="listitem">
Added the <code class="computeroutput"><span class="keyword">noexcept</span></code> qualifier
to socket move constructors.
</li>
<li class="listitem">
Fixed issues associated with opening serial ports on Windows:
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
Use the correct constant to initialise the RTS control flag.
</li>
<li class="listitem">
Specify a default baud rate (9600).
</li>
</ul></div>
</li>
<li class="listitem">
Fixed a lost "outstanding work count" that can occur when an
asynchronous accept operation is automatically restarted.
</li>
</ul></div>
<h4>
<a name="asio.history.h21"></a>
<span><a name="asio.history.asio_1_14_1"></a></span><a class="link" href="history.html#asio.history.asio_1_14_1">Asio
1.14.1</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Improved performance slightly by eliminating a redundant move construction
when completed handlers are dispatched.
</li>
<li class="listitem">
Eliminated a compiler warning by annotating a <code class="computeroutput"><span class="keyword">case</span></code>
fall-through in the free function <code class="computeroutput"><span class="identifier">connect</span><span class="special">()</span></code> implementation.
</li>
<li class="listitem">
Fixed the <code class="computeroutput"><span class="identifier">is_</span><span class="special">*</span><span class="identifier">_buffer_sequence</span></code> detection traits for
user-defined sequence types.
</li>
<li class="listitem">
Fixed some Windows-specific warnings about an incompatible pointer cast
when obtaining the <code class="computeroutput"><span class="identifier">CancelIoEx</span></code>
entry point.
</li>
<li class="listitem">
Changed to automatically set the defaults when opening a serial port on
Windows.
</li>
<li class="listitem">
Changed the serial port <code class="computeroutput"><span class="identifier">get_option</span><span class="special">()</span></code> member function to be const.
</li>
<li class="listitem">
Fixed a name hiding issue with the WinRT stream-oriented socket backend's
<code class="computeroutput"><span class="identifier">shutdown</span></code> function.
</li>
<li class="listitem">
Applied a minor fix to the documentation for <code class="computeroutput"><span class="identifier">is_dynamic_buffer</span></code>.
</li>
<li class="listitem">
Added some support for Haiku OS.
</li>
<li class="listitem">
Added wolfSSL compatability.
</li>
<li class="listitem">
Changed to require C++17 or later for coroutines TS support with clang.
</li>
<li class="listitem">
Fixed a doxygen generation problem in the tutorial.
</li>
</ul></div>
<h4>
<a name="asio.history.h22"></a>
<span><a name="asio.history.asio_1_14_0"></a></span><a class="link" href="history.html#asio.history.asio_1_14_0">Asio
1.14.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Improved I/O object performance by adding runtime detection of native I/O
executors when using the polymorphic executor wrapper.
</li>
<li class="listitem">
Changed I/O object move constructors so that the executor is copied, not
moved. This ensures that the moved-from I/O object is left in the same
state as if constructed with a valid executor but without a resource.
</li>
<li class="listitem">
On Windows, fixed an issue where global object destructors were not being
run.
</li>
<li class="listitem">
Fixed move-based <code class="computeroutput"><span class="identifier">async_accept</span></code>
between sockets with different executor types.
</li>
</ul></div>
<h4>
<a name="asio.history.h23"></a>
<span><a name="asio.history.asio_1_13_0"></a></span><a class="link" href="history.html#asio.history.asio_1_13_0">Asio
1.13.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added custom I/O executor support to I/O objects.
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
All I/O objects now have an additional <code class="computeroutput"><span class="identifier">Executor</span></code>
template parameter. This template parameter defaults to the <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">executor</span></code> type (the polymorphic
executor wrapper) but can be used to specify a user-defined executor
type.
</li>
<li class="listitem">
I/O objects' constructors and functions that previously took an
<code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_context</span><span class="special">&amp;</span></code>
now accept either an <code class="computeroutput"><span class="identifier">Executor</span></code>
or a reference to a concrete <code class="computeroutput"><span class="identifier">ExecutionContext</span></code>
(such as <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_context</span></code> or <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">thread_pool</span></code>).
</li>
<li class="listitem">
<p class="simpara">
Note: One potential source of breakage in existing user code is when
reusing an I/O object's <code class="computeroutput"><span class="identifier">io_context</span></code>
for constructing another I/O object, as in:
</p>
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">steady_timer</span> <span class="identifier">my_timer</span><span class="special">(</span><span class="identifier">my_socket</span><span class="special">.</span><span class="identifier">get_executor</span><span class="special">().</span><span class="identifier">context</span><span class="special">());</span>
</pre>
<p class="simpara">
<br> To fix this, either construct the second I/O object using
the first I/O object's executor:<br>
</p>
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">steady_timer</span> <span class="identifier">my_timer</span><span class="special">(</span><span class="identifier">my_socket</span><span class="special">.</span><span class="identifier">get_executor</span><span class="special">());</span>
</pre>
<p class="simpara">
<br> or otherwise explicitly pass the <code class="computeroutput"><span class="identifier">io_context</span></code>:<br>
</p>
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">steady_timer</span> <span class="identifier">my_timer</span><span class="special">(</span><span class="identifier">my_io_context</span><span class="special">);</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
The previously deprecated <code class="computeroutput"><span class="identifier">get_io_context</span></code>
and <code class="computeroutput"><span class="identifier">get_io_service</span></code>
member functions have now been removed.
</li>
<li class="listitem">
The previously deprecated service template parameters, and the corresponding
classes, have now been removed.
</li>
</ul></div>
</li>
<li class="listitem">
Added a new <code class="computeroutput"><span class="identifier">async_result</span></code>
form with an <code class="computeroutput"><span class="identifier">initiate</span></code> static
member function.
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
<p class="simpara">
The <code class="computeroutput"><span class="identifier">async_result</span></code>
template now supports a new form:
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">CompletionToken</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Signature</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">async_result</span>
<span class="special">{</span>
<span class="keyword">typedef</span> <span class="comment">/* ... */</span> <span class="identifier">return_type</span><span class="special">;</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Initiation</span><span class="special">,</span>
<span class="keyword">typename</span> <span class="identifier">RawCompletionToken</span><span class="special">,</span>
<span class="keyword">typename</span><span class="special">...</span> <span class="identifier">Args</span><span class="special">&gt;</span>
<span class="keyword">static</span> <span class="identifier">return_type</span> <span class="identifier">initiate</span><span class="special">(</span>
<span class="identifier">Initiation</span><span class="special">&amp;&amp;</span> <span class="identifier">initiation</span><span class="special">,</span>
<span class="identifier">RawCompletionToken</span><span class="special">&amp;&amp;</span> <span class="identifier">token</span><span class="special">,</span>
<span class="identifier">Args</span><span class="special">&amp;&amp;...</span> <span class="identifier">args</span><span class="special">);</span>
<span class="special">};</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
The <code class="computeroutput"><span class="identifier">initiate</span></code> member
function must: (a) transform the token into a completion handler
object <code class="computeroutput"><span class="identifier">handler</span></code>; (b)
cause the invocation of the function object <code class="computeroutput"><span class="identifier">initiation</span></code>
as if by calling <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">forward</span><span class="special">&lt;</span><span class="identifier">Initiation</span><span class="special">&gt;(</span><span class="identifier">initiation</span><span class="special">)(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">handler</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">forward</span><span class="special">&lt;</span><span class="identifier">Args</span><span class="special">&gt;(</span><span class="identifier">args</span><span class="special">)...)</span></code>. Note that the invocation of
<code class="computeroutput"><span class="identifier">initiation</span></code> may be
deferred (e.g. lazily evaluated), in which case <code class="computeroutput"><span class="identifier">initiation</span></code>
and <code class="computeroutput"><span class="identifier">args</span></code> must be
decay-copied and moved as required.
</li>
<li class="listitem">
A helper function template <code class="computeroutput"><span class="identifier">async_initiate</span></code>
has also been added as a wrapper for the invocation of <code class="computeroutput"><span class="identifier">async_result</span><span class="special">&lt;&gt;::</span><span class="identifier">initiate</span></code>. For backward compatibility,
this function supports both the old and new <code class="computeroutput"><span class="identifier">async_result</span></code>
forms.
</li>
<li class="listitem">
The composed operations examples have been updated to use <code class="computeroutput"><span class="identifier">async_initiate</span></code>.
</li>
<li class="listitem">
The previously deprecated <code class="computeroutput"><span class="identifier">handler_type</span></code>
trait and single-argument form of <code class="computeroutput"><span class="identifier">async_result</span></code>
have now been removed.
</li>
</ul></div>
</li>
<li class="listitem">
Updated the Coroutines TS support and promoted it to the <code class="computeroutput"><span class="identifier">asio</span></code> namespace.
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
The <code class="computeroutput"><span class="identifier">awaitable</span><span class="special">&lt;&gt;</span></code>,
<code class="computeroutput"><span class="identifier">co_spawn</span></code>, <code class="computeroutput"><span class="identifier">this_coro</span></code>, <code class="computeroutput"><span class="identifier">detached</span></code>,
and <code class="computeroutput"><span class="identifier">redirect_error</span></code>
facilities have been moved from the <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">experimental</span></code>
namespace to namespace <code class="computeroutput"><span class="identifier">asio</span></code>.
As part of this change, the <code class="computeroutput"><span class="identifier">this_coro</span><span class="special">::</span><span class="identifier">token</span><span class="special">()</span></code> awaitable has been superseded by
the <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">use_awaitable</span></code> completion token.
</li>
<li class="listitem">
Please note that the <code class="computeroutput"><span class="identifier">use_awaitable</span></code>
and <code class="computeroutput"><span class="identifier">redirect_error</span></code>
completion tokens work only with asynchronous operations that use
the new form of <code class="computeroutput"><span class="identifier">async_result</span></code>
with member function <code class="computeroutput"><span class="identifier">initiate</span></code>.
Furthermore, when using <code class="computeroutput"><span class="identifier">use_awaitable</span></code>,
please be aware that the asynchronous operation is not initiated
until <code class="computeroutput"><span class="identifier">co_await</span></code> is
applied to the <code class="computeroutput"><span class="identifier">awaitable</span><span class="special">&lt;&gt;</span></code>.
</li>
</ul></div>
</li>
<li class="listitem">
Added a new <code class="computeroutput"><span class="identifier">DynamicBuffer_v2</span></code>
concept which is CopyConstructible.
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
<p class="simpara">
This change adds a new set of type requirements for dynamic buffers,
<code class="computeroutput"><span class="identifier">DynamicBuffer_v2</span></code>,
which supports copy construction. These new type requirements enable
dynamic buffers to be used as arguments to user-defined composed
operations, where the same dynamic buffer object is used repeatedly
for multiple underlying operations. For example:<br>
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">DynamicBuffer</span><span class="special">&gt;</span>
<span class="keyword">void</span> <span class="identifier">echo_line</span><span class="special">(</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">&amp;</span> <span class="identifier">sock</span><span class="special">,</span> <span class="identifier">DynamicBuffer</span> <span class="identifier">buf</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">n</span> <span class="special">=</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">read_until</span><span class="special">(</span><span class="identifier">sock</span><span class="special">,</span> <span class="identifier">buf</span><span class="special">,</span> <span class="char">'\n'</span><span class="special">);</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">write</span><span class="special">(</span><span class="identifier">sock</span><span class="special">,</span> <span class="identifier">buf</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">transfer_exactly</span><span class="special">(</span><span class="identifier">n</span><span class="special">));</span>
<span class="special">}</span>
</pre>
<p class="simpara">
<br>
</p>
</li>
<li class="listitem">
The original <code class="computeroutput"><span class="identifier">DynamicBuffer</span></code>
type requirements have been renamed to <code class="computeroutput"><span class="identifier">DynamicBuffer_v1</span></code>.
These requirements continue to be compatible with the Networking
TS.
</li>
<li class="listitem">
New type traits <code class="computeroutput"><span class="identifier">is_dynamic_buffer_v1</span></code>
and <code class="computeroutput"><span class="identifier">is_dynamic_buffer_v2</span></code>
have been added to test for conformance to <code class="computeroutput"><span class="identifier">DynamicBuffer_v1</span></code>
and <code class="computeroutput"><span class="identifier">DynamicBuffer_v2</span></code>
respectively. The existing <code class="computeroutput"><span class="identifier">is_dynamic_buffer</span></code>
trait has been retained and delegates to <code class="computeroutput"><span class="identifier">is_dynamic_buffer_v1</span></code>
(unless <code class="computeroutput"><span class="identifier">ASIO_NO_DYNAMIC_BUFFER_V1</span></code>
is explicitly defined, in which case it delegates to <code class="computeroutput"><span class="identifier">is_dynamic_buffer_v2</span></code>).
</li>
<li class="listitem">
For convenience, the <code class="computeroutput"><span class="identifier">dynamic_string_buffer</span></code>
and <code class="computeroutput"><span class="identifier">dynamic_vector_buffer</span></code>
classes conform to both <code class="computeroutput"><span class="identifier">DynamicBuffer_v1</span></code>
and <code class="computeroutput"><span class="identifier">DynamicBuffer_v2</span></code>
requirements.
</li>
<li class="listitem">
When <code class="computeroutput"><span class="identifier">ASIO_NO_DYNAMIC_BUFFER_V1</span></code>
is defined, all support for <code class="computeroutput"><span class="identifier">DynamicBuffer_v1</span></code>
types and functions is #ifdef-ed out. Support for using <code class="computeroutput"><span class="identifier">basic_streambuf</span></code> with the <code class="computeroutput"><span class="identifier">read</span></code>, <code class="computeroutput"><span class="identifier">async_read</span></code>,
<code class="computeroutput"><span class="identifier">read_until</span></code>, <code class="computeroutput"><span class="identifier">async_read_until</span></code>, <code class="computeroutput"><span class="identifier">write</span></code>, and <code class="computeroutput"><span class="identifier">async_write</span></code>
functions is also disabled as a consequence.
</li>
<li class="listitem">
Note: This change should have no impact on existing source code that
simply uses dynamic buffers in conjunction with Asio's composed operations.
</li>
</ul></div>
</li>
<li class="listitem">
Added a new <code class="computeroutput"><span class="identifier">async_compose</span></code>
function that simplifies the implementation of user-defined asynchronous
operations.
</li>
<li class="listitem">
Added a <code class="computeroutput"><span class="identifier">make_strand</span></code> function,
which creates a <code class="computeroutput"><span class="identifier">strand</span></code>
with a deduced <code class="computeroutput"><span class="identifier">Executor</span></code>
template argument.
</li>
<li class="listitem">
Relaxed the completion condition type requirements to only require move-constructibility
rather than copy-constructibility.
</li>
<li class="listitem">
Added a constructor for <code class="computeroutput"><span class="identifier">local</span><span class="special">::</span><span class="identifier">basic_endpoint</span></code>
that takes a <code class="computeroutput"><span class="identifier">string_view</span></code>.
</li>
<li class="listitem">
Added the noexcept qualifier to various member functions of the <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">address</span></code>, <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">address_v4</span></code>,
<code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">address_v6</span></code>, <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_endpoint</span></code>,
and <code class="computeroutput"><span class="identifier">executor_work_guard</span></code>
classes.
</li>
<li class="listitem">
Added the noexcept qualifier to the <code class="computeroutput"><span class="identifier">buffer_sequence_begin</span></code>
and <code class="computeroutput"><span class="identifier">buffer_sequence_end</span></code>
functions.
</li>
<li class="listitem">
Added a new <code class="computeroutput"><span class="identifier">ASIO_DISABLE_VISIBILITY</span></code>
configuration <code class="computeroutput"><span class="preprocessor">#define</span></code>
that allows visibility pragmas to be disabled. (Note: If symbols are hidden,
extra care must be taken to ensure that Asio types are not passed across
shared library API boundaries.)
</li>
<li class="listitem">
Changed compile-time feature detection to define <code class="computeroutput"><span class="identifier">ASIO_STANDALONE</span></code>
automatically if C++11 or later is detected.
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
Users should define <code class="computeroutput"><span class="identifier">ASIO_ENABLE_BOOST</span></code>
to explicitly disable standalone mode when compiling with C++11 or
later.
</li>
<li class="listitem">
The <code class="computeroutput"><span class="identifier">configure</span></code> script
now defaults to a standalone build unless Boost is specified or detected.
</li>
</ul></div>
</li>
<li class="listitem">
Enabled recycling of the memory used to type-erase a function object with
the polymorphic executor.
</li>
<li class="listitem">
Changed receive operations to return the correct number of bytes transferred
when truncation (<code class="computeroutput"><span class="identifier">error</span><span class="special">::</span><span class="identifier">message_size</span></code>)
occurs on a datagram-oriented socket.
</li>
<li class="listitem">
Fixed multicast behaviour on QNX by automatically applying <code class="computeroutput"><span class="identifier">SO_REUSEPORT</span></code> when the <code class="computeroutput"><span class="identifier">reuse_address</span></code>
option is set.
</li>
<li class="listitem">
Added inclusion of <code class="computeroutput"><span class="identifier">unistd</span><span class="special">.</span><span class="identifier">h</span></code> when
targeting Haiku OS, to fix feature detection.
</li>
<li class="listitem">
Added the <code class="computeroutput"><span class="identifier">network_v</span><span class="special">[</span><span class="number">46</span><span class="special">].</span><span class="identifier">hpp</span></code>
headers to the top-level convenience header.
</li>
<li class="listitem">
Fixed calculation of absolute timeout when the backend uses <code class="computeroutput"><span class="identifier">pthread_cond_timedwait</span></code>.
</li>
<li class="listitem">
Changed the range-based asynchronous connect operation to deduce the <code class="computeroutput"><span class="identifier">EndpointSequence</span></code> iterator type rather
than assume the presence of a <code class="computeroutput"><span class="identifier">const_iterator</span></code>
typedef.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">buffer_sequence_begin</span></code>
and <code class="computeroutput"><span class="identifier">buffer_sequence_end</span></code>
to prevent implicit conversion. This change addresses an issue where a
call to <code class="computeroutput"><span class="identifier">buffer_sequence_begin</span></code>
or <code class="computeroutput"><span class="identifier">buffer_sequence_end</span></code>
could trigger an implicit conversion to <code class="computeroutput"><span class="identifier">const_buffer</span></code>
or <code class="computeroutput"><span class="identifier">mutable_buffer</span></code>. Whenever
this implicit conversion occurred, the return value of <code class="computeroutput"><span class="identifier">buffer_sequence_begin</span></code>
or <code class="computeroutput"><span class="identifier">buffer_sequence_end</span></code>
would point to a temporary object.
</li>
<li class="listitem">
Ensured SSL handshake errors are propagated to the peer before the local
operation completes.
</li>
<li class="listitem">
Suppressed the <code class="computeroutput"><span class="identifier">eof</span></code> error
on SSL shutdown as it actually indicates success.
</li>
<li class="listitem">
Added a fallback error code for when we OpenSSL produces an <code class="computeroutput"><span class="identifier">SSL_ERROR_SYSCALL</span></code> result without an associated
error.
</li>
<li class="listitem">
Changed composed asynchronous read and write operations to move, rather
than copy, the buffer sequence objects when the composed operation implementation
is moved.
</li>
<li class="listitem">
Changed to use <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">atomic</span><span class="special">&gt;</span></code> when targeting apple/clang/libc++ with
recent Xcode versions, even for C++03. This fixes a warning about the deprecation
of <code class="computeroutput"><span class="identifier">OSMemoryBarrier</span></code>.
</li>
<li class="listitem">
Fixed compile errors that occur when using the composed read and write
operations with MSVC 11.0, by disabling <code class="computeroutput"><span class="keyword">decltype</span></code>
support for that compiler.
</li>
<li class="listitem">
Increased the default value of <code class="computeroutput"><span class="identifier">_WIN32_WINNT</span></code>
to <code class="computeroutput"><span class="number">0x0601</span></code> (Windows 7).
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">dispatch</span></code> documentation
to note that it may call the supplied function object in the current thread.
</li>
<li class="listitem">
Updated <code class="computeroutput"><span class="identifier">post</span></code> and <code class="computeroutput"><span class="identifier">defer</span></code> documentation to clarify the the
distinction between them.
</li>
</ul></div>
<h4>
<a name="asio.history.h24"></a>
<span><a name="asio.history.asio_1_12_2"></a></span><a class="link" href="history.html#asio.history.asio_1_12_2">Asio
1.12.2</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Fixed a problem with the detection of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">future</span></code>
availability with libstdc++.
</li>
<li class="listitem">
Fixed compile error in regex overload of <code class="computeroutput"><span class="identifier">read_until</span></code>.
</li>
<li class="listitem">
Fixed a timer heap corruption issue that can occur when moving a cancelled
timer.
</li>
<li class="listitem">
Fixed detection of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">string_view</span></code>
and <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string_view</span></code> with newer clang/libc++.
</li>
<li class="listitem">
Fixed MSVC version detection for availability of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invoke_result</span></code>.
</li>
<li class="listitem">
Fixed the buffer sequence traits to test the new requirements, if <code class="computeroutput"><span class="keyword">decltype</span></code> is available.
</li>
<li class="listitem">
Fixed an MSVC issue when building with exceptions disabled.
</li>
<li class="listitem">
Added SSL context options for TLS v1.3.
</li>
<li class="listitem">
Added a compile-time test for TLS v1 support.
</li>
<li class="listitem">
Fixed the macro used to test for TLS v1.2 support.
</li>
<li class="listitem">
Prevented global objects from being created once per thread on Windows.
</li>
<li class="listitem">
Fixed a crash when using <code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">max_size</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">empty</span><span class="special">()</span></code> on default-constructed resolver results.
</li>
<li class="listitem">
Changed to move the return value in basic_resolver_results::begin() to
avoid copying.
</li>
<li class="listitem">
Enabled move support for the Intel Compiler.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string_view</span></code> detection issue when using
clang-cl.
</li>
<li class="listitem">
Fixed the handler tracking operation name for <code class="computeroutput"><span class="identifier">io_context</span><span class="special">::</span><span class="identifier">executor_type</span><span class="special">::</span><span class="identifier">dispatch</span></code>.
</li>
<li class="listitem">
Fixed a buffer overflow that could occur when parsing an address string
with a 64-bit scope id.
</li>
<li class="listitem">
Added examples showing how to write composed operations.
</li>
<li class="listitem">
Added C++11 versions of the Timeouts, Timers, SOCKS4 and SSL examples.
</li>
<li class="listitem">
Fixed minor issues in documentation and examples.
</li>
</ul></div>
<h4>
<a name="asio.history.h25"></a>
<span><a name="asio.history.asio_1_12_1"></a></span><a class="link" href="history.html#asio.history.asio_1_12_1">Asio
1.12.1</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added missing const qualifier to <code class="computeroutput"><span class="identifier">basic_socket_acceptor</span><span class="special">::</span><span class="identifier">get_option</span></code>.
</li>
<li class="listitem">
Worked around a parsing error that occurs with some versions of gcc.
</li>
<li class="listitem">
Fixed broken code samples in tutorial.
</li>
<li class="listitem">
Added new experimental features. (Note that "experimental" features
may be changed without notice in subsequent releases.)
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
Added <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">detached</span></code>
completion token.
</li>
<li class="listitem">
Added <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">redirect_error</span></code>
completion token.
</li>
<li class="listitem">
Added <code class="computeroutput"><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">co_spawn</span></code>
facility for integration with the coroutines technical specification.
</li>
</ul></div>
</li>
<li class="listitem">
Updated timeout examples to use latest features.
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
Used <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">steady_timer</span></code> rather than <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">deadline_timer</span></code>.
</li>
<li class="listitem">
Used <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">dynamic_buffer</span></code> rather than <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">streambuf</span></code>.
</li>
<li class="listitem">
Used timed <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_context</span><span class="special">::</span><span class="identifier">run_for</span><span class="special">()</span></code>
function for blocking clients.
</li>
<li class="listitem">
Added example showing a custom completion token for blocking with
timeouts.
</li>
</ul></div>
</li>
<li class="listitem">
Fixed unit tests to compile when <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_NO_DEPRECATED</span></code> is defined.
</li>
<li class="listitem">
Changed socket iostreams to use chrono by default, to fix compatibility
with the Networking TS. Define <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM</span></code>
to enable the old Boost.Date_Time interface in <code class="computeroutput"><span class="identifier">basic_socket_streambuf</span></code>
and <code class="computeroutput"><span class="identifier">basic_socket_iostream</span></code>.
</li>
<li class="listitem">
Updated examples to use chrono rather than Boost.Date_Time.
</li>
<li class="listitem">
Fixed an incorrect member function detector in the <code class="computeroutput"><span class="identifier">is_dynamic_buffer</span></code>
trait.
</li>
<li class="listitem">
Fixed an <code class="computeroutput"><span class="identifier">async_result</span></code> incompatibility
with deprecated <code class="computeroutput"><span class="identifier">handler_type</span></code>.
</li>
<li class="listitem">
Added a missing move optimisation in the SSL stream implementation.
</li>
<li class="listitem">
Fixed incorrect <code class="computeroutput"><span class="identifier">basic_resolver_results</span><span class="special">::</span><span class="identifier">value_type</span></code>
typedef.
</li>
<li class="listitem">
Fixed a compile error with some OpenSSL versions when <code class="computeroutput"><span class="identifier">SSL_OP_NO_COMPRESSION</span></code>
is defined.
</li>
<li class="listitem">
Changed <code class="computeroutput"><span class="identifier">add_certificate_authority</span></code>
to process multiple certificates in a bundle.
</li>
<li class="listitem">
Eliminated deprecation warning with MSVC by using <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invoke_result</span></code>
rather than <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">result_of</span></code>.
</li>
<li class="listitem">
Changed to use <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string_view</span></code> for C++17 or later, and
<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">string_view</span></code> for C++14. Define the preprocessor
macro <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_DISABLE_STD_STRING_VIEW</span></code>
to force the use of std::experimental::string_view (assuming it is available)
when compiling in C++17 mode.
</li>
<li class="listitem">
Ensured <code class="computeroutput"><span class="identifier">DynamicBuffer</span></code> template
arguments are decayed before using in <code class="computeroutput"><span class="identifier">enable_if</span></code>
tests.
</li>
<li class="listitem">
Changed documentation to distinguish legacy completion handlers (which
are still required to be CopyConstructible) from new MoveConstructible
handlers.
</li>
<li class="listitem">
Suppressed a discarded return value warning in the buffer debugging support.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">basic_yield_context</span></code>
to work with completion signatures containing reference parameters.
</li>
<li class="listitem">
Ensured that stackful coroutines launched using <code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code> correctly store decayed copies of their
function and handler arguments.
</li>
<li class="listitem">
Fixed some compatibility issues with Android.
</li>
<li class="listitem">
Fixed some minor portability issues in examples.
</li>
</ul></div>
<h4>
<a name="asio.history.h26"></a>
<span><a name="asio.history.asio_1_12_0"></a></span><a class="link" href="history.html#asio.history.asio_1_12_0">Asio
1.12.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Completed the interface changes to reflect the Networking TS (<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4656.pdf" target="_top">N4656</a>).
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
See the <a class="link" href="net_ts.html" title="Networking TS compatibility">list</a> of new interfaces
and, where applicable, the corresponding old interfaces that have
been superseded.
</li>
<li class="listitem">
The service template parameters, and the corresponding classes, are
disabled by default. For example, instead of <code class="computeroutput"><span class="identifier">basic_socket</span><span class="special">&lt;</span><span class="identifier">Protocol</span><span class="special">,</span> <span class="identifier">SocketService</span><span class="special">&gt;</span></code> we now have simply <code class="computeroutput"><span class="identifier">basic_socket</span><span class="special">&lt;</span><span class="identifier">Protocol</span><span class="special">&gt;</span></code>.
The old interface can be enabled by defining the <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_ENABLE_OLD_SERVICES</span></code> macro.
</li>
</ul></div>
</li>
<li class="listitem">
Added support for customised handler tracking.
</li>
<li class="listitem">
Added reactor-related (i.e. descriptor readiness) events to handler tracking.
</li>
<li class="listitem">
Added special <a class="link" href="overview/core/concurrency_hint.html" title="Concurrency Hints">concurrency
hint</a> values that may be used to disable locking on a per <code class="computeroutput"><span class="identifier">io_context</span></code> basis.
</li>
<li class="listitem">
Enabled perfect forwarding for the first <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span><span class="special">&lt;&gt;</span></code> constructor argument.
</li>
<li class="listitem">
Added ability to release ownership of the underlying native socket. (Requires
Windows 8.1 or later when using the I/O completion port backend.)
</li>
</ul></div>
<h4>
<a name="asio.history.h27"></a>
<span><a name="asio.history.asio_1_11_0"></a></span><a class="link" href="history.html#asio.history.asio_1_11_0">Asio
1.11.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Implemented changes to substantially reflect the Networking Library Proposal
(<a href="../www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4370.html" target="_top">N4370</a>).
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
New <code class="computeroutput"><span class="identifier">Executor</span></code> type
requirements and classes to support an executor framework, including
the <code class="computeroutput"><span class="identifier">execution_context</span></code>
base class, the <code class="computeroutput"><span class="identifier">executor_work</span></code>
class for tracking outstanding work, and the <code class="computeroutput"><span class="identifier">executor</span></code>
polymorphic wrapper. Free functions <code class="computeroutput"><span class="identifier">dispatch</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">post</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">defer</span><span class="special">()</span></code> have been added and are used to
submit function objects to executors.
</li>
<li class="listitem">
Completion handlers now have an associated executor and associated
allocator. The free function <code class="computeroutput"><span class="identifier">wrap</span><span class="special">()</span></code> is used to associate an executor
with a handler or other object. The handler hooks for allocation,
invocation and continuation have been deprecated.
</li>
<li class="listitem">
A <code class="computeroutput"><span class="identifier">system_executor</span></code>
class has been added as a default executor.
</li>
<li class="listitem">
The <code class="computeroutput"><span class="identifier">io_service</span></code> class
is now derived from <code class="computeroutput"><span class="identifier">execution_context</span></code>
and implements the executor type requirements in its nested <code class="computeroutput"><span class="identifier">executor_type</span></code> class. The member
functions <code class="computeroutput"><span class="identifier">dispatch</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">post</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">defer</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">wrap</span><span class="special">()</span></code> have been deprecated. The <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">work</span></code> class has been deprecated.
</li>
<li class="listitem">
The <code class="computeroutput"><span class="identifier">io_service</span></code> member
function <code class="computeroutput"><span class="identifier">reset</span><span class="special">()</span></code>
has been renamed to <code class="computeroutput"><span class="identifier">restart</span><span class="special">()</span></code>. The old name is retained for backward
compatibility but has been deprecated.
</li>
<li class="listitem">
The <code class="computeroutput"><span class="identifier">make_service</span><span class="special">&lt;&gt;()</span></code> function is now used to
add a new service to an execution context such as an <code class="computeroutput"><span class="identifier">io_service</span></code>. The <code class="computeroutput"><span class="identifier">add_service</span><span class="special">()</span></code> function has been deprecated.
</li>
<li class="listitem">
A new <code class="computeroutput"><span class="identifier">strand</span><span class="special">&lt;&gt;</span></code>
template has been added to allow strand functionality to be used
with generic executor types.
</li>
<li class="listitem">
I/O objects (such as sockets and timers) now provide access to their
associated <code class="computeroutput"><span class="identifier">io_service</span></code>
via a <code class="computeroutput"><span class="identifier">context</span><span class="special">()</span></code>
member function. The <code class="computeroutput"><span class="identifier">get_io_service</span><span class="special">()</span></code> member function is deprecated.
</li>
<li class="listitem">
All asynchronous operations and executor operations now support move-only
handlers. However, the deprecated <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">post</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">dispatch</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">strand</span><span class="special">::</span><span class="identifier">post</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">strand</span><span class="special">::</span><span class="identifier">dispatch</span><span class="special">()</span></code> functions still require copyable
handlers.
</li>
<li class="listitem">
Waitable timer objects are now movable.
</li>
<li class="listitem">
Waitable timers, socket iostreams and socket streambufs now provide
an <code class="computeroutput"><span class="identifier">expiry</span><span class="special">()</span></code>
member function for obtaining the expiry time. The accessors <code class="computeroutput"><span class="identifier">expires_at</span><span class="special">()</span></code>
and <code class="computeroutput"><span class="identifier">expires_after</span><span class="special">()</span></code> have been deprecated, though those
names are retained for the mutating members.
</li>
<li class="listitem">
The <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">packaged_task</span></code> class template is
now supported as a completion handler. The initiating operation automatically
returns the future associated with the task. The <code class="computeroutput"><span class="identifier">package</span><span class="special">()</span></code> function has been added as a convenient
factory for packaged tasks.
</li>
<li class="listitem">
Sockets, socket acceptors and descriptors now provide <code class="computeroutput"><span class="identifier">wait</span><span class="special">()</span></code>
and <code class="computeroutput"><span class="identifier">async_wait</span><span class="special">()</span></code>
operations that may be used to wait for readiness. The <code class="computeroutput"><span class="identifier">null_buffers</span></code> type has been deprecated.
</li>
<li class="listitem">
The proposed error code enum classes are simulated using namespaces.
Existing asio error codes now have a correspondence with the standard
error conditions.
</li>
<li class="listitem">
Conversion between IP address types, and conversion from string to
address, is now supported via the <code class="computeroutput"><span class="identifier">address_cast</span><span class="special">&lt;&gt;()</span></code>, <code class="computeroutput"><span class="identifier">make_address</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">make_address_v4</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">make_address_v6</span><span class="special">()</span></code> free functions. The <code class="computeroutput"><span class="identifier">from_string</span><span class="special">()</span></code>,
<code class="computeroutput"><span class="identifier">to_v4</span><span class="special">()</span></code>,
<code class="computeroutput"><span class="identifier">to_v6</span><span class="special">()</span></code>
and <code class="computeroutput"><span class="identifier">v4_mapped</span><span class="special">()</span></code>
member functions have been deprecated.
</li>
<li class="listitem">
A default-constructed <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">address</span></code>
now represents an invalid address value that is neither IPv4 nor
IPv6.
</li>
<li class="listitem">
New <code class="computeroutput"><span class="identifier">buffer</span><span class="special">()</span></code>
overloads that generate mutable buffers for non-const <code class="computeroutput"><span class="identifier">string</span></code> objects.
</li>
<li class="listitem">
Support for dynamic buffer sequences that automatically grow and
shrink to accomodate data as it is read or written. This is a generic
facility similar to the existing <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">streambuf</span></code>
class. This support includes:
<div class="itemizedlist"><ul class="itemizedlist" type="square">
<li class="listitem">
New <code class="computeroutput"><span class="identifier">dynamic_string_buffer</span></code>
and <code class="computeroutput"><span class="identifier">dynamic_vector_buffer</span></code>
adapter classes that meet the <code class="computeroutput"><span class="identifier">DynamicBufferSequence</span></code>
type requirements.
</li>
<li class="listitem">
New <code class="computeroutput"><span class="identifier">dynamic_buffer</span><span class="special">()</span></code> factory functions for creating
a dynamic buffer adapter for a <code class="computeroutput"><span class="identifier">vector</span></code>
or <code class="computeroutput"><span class="identifier">string</span></code>.
</li>
<li class="listitem">
New overloads for the <code class="computeroutput"><span class="identifier">read</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">async_read</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">write</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">async_write</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">read_until</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">async_read_until</span><span class="special">()</span></code> free functions that directly
support dynamic buffer sequences.
</li>
</ul></div>
</li>
<li class="listitem">
Support for networks and address ranges. Thanks go to Oliver Kowalke
for contributing to the design and providing the implementation on
which this facility is based. The following new classes have been
added:
<div class="itemizedlist"><ul class="itemizedlist" type="square">
<li class="listitem">
<code class="computeroutput"><span class="identifier">address_iterator_v4</span></code>
for iterating across IPv4 addresses
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">address_iterator_v6</span></code>
for iterating across IPv6 addresses
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">address_range_v4</span></code>
to represent a range of IPv4 addresses
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">address_range_v6</span></code>
to represent a range of IPv6 addresses
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">network_v4</span></code>
for manipulating IPv4 CIDR addresses, e.g. 1.2.3.0/24
</li>
<li class="listitem">
<code class="computeroutput"><span class="identifier">network_v6</span></code>
for manipulating IPv6 CIDR addresses, e.g. ffe0:/120
</li>
</ul></div>
</li>
<li class="listitem">
New convenience headers in <code class="literal">&lt;asio/ts/*.hpp&gt;</code>
that correspond to the headers in the proposal.
</li>
</ul></div>
</li>
<li class="listitem">
Added a new, executor-aware <code class="computeroutput"><span class="identifier">thread_pool</span></code>
class.
</li>
<li class="listitem">
Changed <code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code>
to be executor-aware.
</li>
<li class="listitem">
Added a new <code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code>
overload that takes only a function object.
</li>
<li class="listitem">
Changed <code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code>
and <code class="computeroutput"><span class="identifier">yield_context</span></code> to permit
nested calls to the completion handler.
</li>
<li class="listitem">
Removed previously deprecated functions.
</li>
<li class="listitem">
Added options for disabling TLS v1.1 and v1.2.
</li>
<li class="listitem">
Changed the SSL wrapper to call the password callback when loading an in-memory
key.
</li>
<li class="listitem">
Changed the tutorial to use <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span></code>
to ensure output is flushed.
</li>
<li class="listitem">
Fixed false SSL error reports by ensuring that the SSL error queue is cleared
prior to each operation.
</li>
<li class="listitem">
Fixed an <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span><span class="special">&lt;&gt;</span></code>
bug that may result in spurious 'short read' errors.
</li>
<li class="listitem">
Enabled perfect forwarding for the first <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span><span class="special">&lt;&gt;</span></code> constructor argument.
</li>
<li class="listitem">
Added standalone Asio support for Clang when used with libstdc++ and C++11.
</li>
<li class="listitem">
Fixed an unsigned integer overflow reported by Clang's integer sanitizer.
</li>
<li class="listitem">
Added support for move-only return types when using a <code class="computeroutput"><span class="identifier">yield_context</span></code>
object with asynchronous operations.
</li>
<li class="listitem">
Ensured errors generated by Windows' <code class="computeroutput"><span class="identifier">ConnectEx</span></code>
function are mapped to their portable equivalents.
</li>
<li class="listitem">
Changed multicast test to treat certain <code class="computeroutput"><span class="identifier">join_group</span></code>
failures as non-fatal.
</li>
</ul></div>
<h4>
<a name="asio.history.h28"></a>
<span><a name="asio.history.asio_1_10_5"></a></span><a class="link" href="history.html#asio.history.asio_1_10_5">Asio
1.10.5</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Fixed the <code class="literal">kqueue</code> reactor so that it works on FreeBSD.
</li>
<li class="listitem">
Fixed an issue in the <code class="literal">kqueue</code> reactor which resulted
in spinning when using serial ports on Mac OS.
</li>
<li class="listitem">
Fixed <code class="literal">kqueue</code> reactor support for read-only file descriptors.
</li>
<li class="listitem">
Fixed a compile error when using the <code class="literal">/dev/poll</code> reactor.
</li>
<li class="listitem">
Changed the Windows backend to use <code class="computeroutput"><span class="identifier">WSASocketW</span></code>,
as <code class="computeroutput"><span class="identifier">WSASocketA</span></code> has been
deprecated.
</li>
<li class="listitem">
Fixed some warnings reported by Visual C++ 2013.
</li>
<li class="listitem">
Fixed integer type used in the WinRT version of the byte-order conversion
functions.
</li>
<li class="listitem">
Changed documentation to indicate that <code class="computeroutput"><span class="identifier">use_future</span></code>
and <code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code>
are not made available when including the <code class="computeroutput"><span class="identifier">asio</span><span class="special">.</span><span class="identifier">hpp</span></code>
convenience header.
</li>
<li class="listitem">
Explicitly marked <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">strand</span></code>
as deprecated. Use <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">strand</span></code>
instead.
</li>
</ul></div>
<h4>
<a name="asio.history.h29"></a>
<span><a name="asio.history.asio_1_10_4"></a></span><a class="link" href="history.html#asio.history.asio_1_10_4">Asio
1.10.4</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Stopped using certain Winsock functions that are marked as deprecated in
the latest Visual C++ and Windows SDK.
</li>
<li class="listitem">
Fixed a shadow variable warning on Windows.
</li>
<li class="listitem">
Fixed a regression in the <code class="literal">kqueue</code> backend that was introduced
in Asio 1.10.2.
</li>
<li class="listitem">
Added a workaround for building the unit tests with <code class="literal">gcc</code>
on AIX.
</li>
</ul></div>
<h4>
<a name="asio.history.h30"></a>
<span><a name="asio.history.asio_1_10_3"></a></span><a class="link" href="history.html#asio.history.asio_1_10_3">Asio
1.10.3</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Worked around a <code class="literal">gcc</code> problem to do with anonymous enums.
</li>
<li class="listitem">
Reverted the Windows <code class="computeroutput"><span class="identifier">HANDLE</span></code>
backend change to ignore <code class="computeroutput"><span class="identifier">ERROR_MORE_DATA</span></code>.
Instead, the error will be propagated as with any other (i.e. in an <code class="computeroutput"><span class="identifier">error_code</span></code> or thrown as a <code class="computeroutput"><span class="identifier">system_error</span></code>), and the number of bytes
transferred will be returned. For code that needs to handle partial messages,
the <code class="computeroutput"><span class="identifier">error_code</span></code> overload
should be used.
</li>
<li class="listitem">
Fixed an off-by-one error in the <code class="computeroutput"><span class="identifier">signal_set</span></code>
implementation's signal number check.
</li>
<li class="listitem">
Changed the Windows IOCP backend to not assume that <code class="computeroutput"><span class="identifier">SO_UPDATE_CONNECT_CONTEXT</span></code>
is defined.
</li>
<li class="listitem">
Fixed a Windows-specific issue, introduced in Asio 1.10.2, by using <code class="computeroutput"><span class="identifier">VerifyVersionInfo</span></code> rather than <code class="computeroutput"><span class="identifier">GetVersionEx</span></code>, as <code class="computeroutput"><span class="identifier">GetVersionEx</span></code>
has been deprecated.
</li>
<li class="listitem">
Changed to use SSE2 intrinsics rather than inline assembly, to allow the
Cray compiler to work.
</li>
</ul></div>
<h4>
<a name="asio.history.h31"></a>
<span><a name="asio.history.asio_1_10_2"></a></span><a class="link" href="history.html#asio.history.asio_1_10_2">Asio
1.10.2</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">spawn</span><span class="special">()</span></code>
to work correctly with new Boost.Coroutine interface.
</li>
<li class="listitem">
Ensured that incomplete <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">spawn</span><span class="special">()</span></code> coroutines are correctly unwound when
cleaned up by the <code class="computeroutput"><span class="identifier">io_service</span></code>
destructor.
</li>
<li class="listitem">
Fixed delegation of continuation hook for handlers produced by <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">wrap</span><span class="special">()</span></code>
and <code class="computeroutput"><span class="identifier">strand</span><span class="special">::</span><span class="identifier">wrap</span><span class="special">()</span></code>.
</li>
<li class="listitem">
Changed the Windows I/O completion port backend to use <code class="computeroutput"><span class="identifier">ConnectEx</span></code>,
if available, for connection-oriented IP sockets.
</li>
<li class="listitem">
Changed the <code class="computeroutput"><span class="identifier">io_service</span></code>
backend for non-Windows (and non-IOCP Windows) platforms to use a single
condition variable per <code class="computeroutput"><span class="identifier">io_service</span></code>
instance. This addresses a potential race condition when <code class="computeroutput"><span class="identifier">run_one</span><span class="special">()</span></code>
is used from multiple threads.
</li>
<li class="listitem">
Prevented integer overflow when computing timeouts based on some <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">chrono</span></code> and <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">chrono</span></code>
clocks.
</li>
<li class="listitem">
Made further changes to <code class="computeroutput"><span class="identifier">EV_CLEAR</span></code>
handling in the kqueue backend, to address other cases where the <code class="computeroutput"><span class="identifier">close</span><span class="special">()</span></code>
system call may hang on Mac OS X.
</li>
<li class="listitem">
Fixed infinite recursion in implementation of <code class="computeroutput"><span class="identifier">resolver_query_base</span><span class="special">::</span><span class="identifier">flags</span><span class="special">::</span><span class="keyword">operator</span><span class="special">~</span></code>.
</li>
<li class="listitem">
Made the <code class="computeroutput"><span class="identifier">select</span></code> reactor
more efficient on Windows for large numbers of sockets.
</li>
<li class="listitem">
Fixed a Windows-specific type-aliasing issue reported by <code class="literal">gcc</code>.
</li>
<li class="listitem">
Prevented execution of compile-time-only buffer test to avoid triggering
an address sanitiser warning.
</li>
<li class="listitem">
Disabled the <code class="computeroutput"><span class="identifier">GetQueuedCompletionStatus</span></code>
timeout workaround on recent versions of Windows.
</li>
<li class="listitem">
Changed implementation for Windows Runtime to use <code class="computeroutput"><span class="identifier">FormatMessageW</span></code>
rather than <code class="computeroutput"><span class="identifier">FormatMessageA</span></code>,
as the Windows store does not permit the latter.
</li>
<li class="listitem">
Added support for string-based scope IDs when using link-local multicast
addresses.
</li>
<li class="listitem">
Changed IPv6 multicast group join to use the address's scope ID as the
interface, if an interface is not explicitly specified.
</li>
<li class="listitem">
Fixed multicast test failure on Mac OS X and the BSDs by using a link-local
multicast address.
</li>
<li class="listitem">
Various minor documentation improvements.
</li>
</ul></div>
<h4>
<a name="asio.history.h32"></a>
<span><a name="asio.history.asio_1_10_1"></a></span><a class="link" href="history.html#asio.history.asio_1_10_1">Asio
1.10.1</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Implemented a limited port to Windows Runtime. This support requires that
the language extensions be enabled. Due to the restricted facilities exposed
by the Windows Runtime API, the port also comes with the following caveats:
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
The core facilities such as the <code class="computeroutput"><span class="identifier">io_service</span></code>,
<code class="computeroutput"><span class="identifier">strand</span></code>, buffers,
composed operations, timers, etc., should all work as normal.
</li>
<li class="listitem">
For sockets, only client-side TCP is supported.
</li>
<li class="listitem">
Explicit binding of a client-side TCP socket is not supported.
</li>
<li class="listitem">
The <code class="computeroutput"><span class="identifier">cancel</span><span class="special">()</span></code>
function is not supported for sockets. Asynchronous operations may
only be cancelled by closing the socket.
</li>
<li class="listitem">
Operations that use <code class="computeroutput"><span class="identifier">null_buffers</span></code>
are not supported.
</li>
<li class="listitem">
Only <code class="computeroutput"><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">no_delay</span></code> and <code class="computeroutput"><span class="identifier">socket_base</span><span class="special">::</span><span class="identifier">keep_alive</span></code>
options are supported.
</li>
<li class="listitem">
Resolvers do not support service names, only numbers. I.e. you must
use "80" rather than "http".
</li>
<li class="listitem">
Most resolver query flags have no effect.
</li>
</ul></div>
</li>
<li class="listitem">
Extended the ability to use Asio without Boost to include Microsoft Visual
Studio 2012. When using a C++11 compiler, most of Asio may now be used
without a dependency on Boost header files or libraries. To use Asio in
this way, define <code class="computeroutput"><span class="identifier">ASIO_STANDALONE</span></code>
on your compiler command line or as part of the project options. This standalone
configuration has been tested for the following platforms and compilers:
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
Microsoft Visual Studio 2012
</li>
<li class="listitem">
Linux with g++ 4.7 or 4.8 (requires <code class="literal">-std=c++11</code>)
</li>
<li class="listitem">
Mac OS X with clang++ / Xcode 4.6 (requires <code class="literal">-std=c++11 -stdlib=libc++</code>)
</li>
</ul></div>
</li>
<li class="listitem">
Fixed a regression (introduced in 1.10.0) where, on some platforms, errors
from <code class="computeroutput"><span class="identifier">async_connect</span></code> were
not correctly propagated through to the completion handler.
</li>
<li class="listitem">
Fixed a Windows-specific regression (introduced in 1.10.0) that occurs
when multiple threads are running an <code class="computeroutput"><span class="identifier">io_service</span></code>.
When the bug occurs, the result of an asynchronous operation (error and
bytes tranferred) is incorrectly discarded and zero values used instead.
For TCP sockets this results in spurious end-of-file notifications.
</li>
<li class="listitem">
Fixed a bug in handler tracking, where it was not correctly printing out
some handler IDs.
</li>
<li class="listitem">
Fixed the comparison used to test for successful synchronous accept operations
so that it works correctly with unsigned socket descriptors.
</li>
<li class="listitem">
Ensured the signal number is correctly passed to the completion handler
when starting an <code class="computeroutput"><span class="identifier">async_wait</span></code>
on a signal that is already raised.
</li>
<li class="listitem">
Suppressed a g++ 4.8+ warning about unused typedefs.
</li>
<li class="listitem">
Enabled the move optimisation for handlers that use the default invocation
hook.
</li>
<li class="listitem">
Clarified that programs must not issue overlapping <code class="computeroutput"><span class="identifier">async_write_at</span></code>
operations.
</li>
<li class="listitem">
Changed the Windows <code class="computeroutput"><span class="identifier">HANDLE</span></code>
backend to treat <code class="computeroutput"><span class="identifier">ERROR_MORE_DATA</span></code>
as a non-fatal error when returned by <code class="computeroutput"><span class="identifier">GetOverlappedResult</span></code>
for a synchronous read.
</li>
<li class="listitem">
Visual C++ language extensions use <code class="computeroutput"><span class="identifier">generic</span></code>
as a keyword. Added a workaround that renames the namespace to <code class="computeroutput"><span class="identifier">cpp_generic</span></code> when those language extensions
are in effect.
</li>
<li class="listitem">
Fixed some asynchronous operations that missed out on getting <code class="computeroutput"><span class="identifier">async_result</span></code> support in 1.10.0. In particular,
the buffered stream templates have been updated so that they adhere to
current handler patterns.
</li>
<li class="listitem">
Enabled move support for Microsoft Visual Studio 2012.
</li>
<li class="listitem">
Added <code class="computeroutput"><span class="identifier">use_future</span></code> support
for Microsoft Visual Studio 2012.
</li>
<li class="listitem">
Removed a use of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">min</span></code> in the Windows IOCP backend to avoid
a dependency on the <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">algorithm</span><span class="special">&gt;</span></code> header.
</li>
<li class="listitem">
Eliminated some unnecessary handler copies.
</li>
<li class="listitem">
Fixed support for older versions of OpenSSL that do not provide the <code class="computeroutput"><span class="identifier">SSL_CTX_clear_options</span></code> function.
</li>
<li class="listitem">
Fixed various minor and cosmetic issues in code and documentation.
</li>
</ul></div>
<h4>
<a name="asio.history.h33"></a>
<span><a name="asio.history.asio_1_10_0"></a></span><a class="link" href="history.html#asio.history.asio_1_10_0">Asio
1.10.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added new traits classes, <code class="computeroutput"><span class="identifier">handler_type</span></code>
and <code class="computeroutput"><span class="identifier">async_result</span></code>, that
allow the customisation of the return type of an initiating function.
</li>
<li class="listitem">
Added the <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">spawn</span><span class="special">()</span></code>
function, a high-level wrapper for running stackful coroutines, based on
the Boost.Coroutine library. The <code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code> function enables programs to implement
asynchronous logic in a synchronous manner. For example: <code class="computeroutput"><span class="identifier">size_t</span> <span class="identifier">n</span>
<span class="special">=</span> <span class="identifier">my_socket</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">my_buffer</span><span class="special">,</span> <span class="identifier">yield</span><span class="special">);</span></code>. For further information, see <a class="link" href="overview/composition/spawn.html" title="Stackful Coroutines">Stackful
Coroutines</a>.
</li>
<li class="listitem">
Added the <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">use_future</span></code> special value, which provides
first-class support for returning a C++11 <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">future</span></code>
from an asynchronous operation's initiating function. For example: <code class="computeroutput"><span class="identifier">future</span><span class="special">&lt;</span><span class="identifier">size_t</span><span class="special">&gt;</span>
<span class="special">=</span> <span class="identifier">my_socket</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">my_buffer</span><span class="special">,</span> <span class="identifier">asio</span><span class="special">::</span><span class="identifier">use_future</span><span class="special">);</span></code>. For further information, see <a class="link" href="overview/composition/futures.html" title="Futures">Futures</a>.
</li>
<li class="listitem">
Promoted the stackless coroutine class and macros to be part of Asio's
documented interface, rather than part of the HTTP server 4 example. For
further information, see <a class="link" href="overview/composition/coroutine.html" title="Stackless Coroutines">Stackless
Coroutines</a>.
</li>
<li class="listitem">
Added a new handler hook called <code class="computeroutput"><span class="identifier">asio_handler_is_continuation</span></code>.
Asynchronous operations may represent a continuation of the asynchronous
control flow associated with the current executing handler. The <code class="computeroutput"><span class="identifier">asio_handler_is_continuation</span></code> hook can
be customised to return <code class="computeroutput"><span class="keyword">true</span></code>
if this is the case, and Asio's implementation can use this knowledge to
optimise scheduling of the new handler. To cover common cases, Asio customises
the hook for strands, <code class="computeroutput"><span class="identifier">spawn</span><span class="special">()</span></code> and composed asynchronous operations.
</li>
<li class="listitem">
Added four new generic protocol classes, <code class="computeroutput"><span class="identifier">generic</span><span class="special">::</span><span class="identifier">datagram_protocol</span></code>,
<code class="computeroutput"><span class="identifier">generic</span><span class="special">::</span><span class="identifier">raw_protocol</span></code>, <code class="computeroutput"><span class="identifier">generic</span><span class="special">::</span><span class="identifier">seq_packet_protocol</span></code>
and <code class="computeroutput"><span class="identifier">generic</span><span class="special">::</span><span class="identifier">stream_protocol</span></code>, which implement the
<code class="computeroutput"><span class="identifier">Protocol</span></code> type requirements,
but allow the user to specify the address family (e.g. <code class="computeroutput"><span class="identifier">AF_INET</span></code>)
and protocol type (e.g. <code class="computeroutput"><span class="identifier">IPPROTO_TCP</span></code>)
at runtime. For further information, see <a class="link" href="overview/networking/other_protocols.html" title="Support for Other Protocols">Support
for Other Protocols</a>.
</li>
<li class="listitem">
Added C++11 move constructors that allow the conversion of a socket (or
acceptor) into a more generic type. For example, an <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span></code>
can be converted into a <code class="computeroutput"><span class="identifier">generic</span><span class="special">::</span><span class="identifier">stream_protocol</span><span class="special">::</span><span class="identifier">socket</span></code>
via move construction. For further information, see <a class="link" href="overview/networking/other_protocols.html" title="Support for Other Protocols">Support
for Other Protocols</a>.
</li>
<li class="listitem">
Extended the <code class="computeroutput"><span class="identifier">basic_socket_acceptor</span><span class="special">&lt;&gt;</span></code>'s <code class="computeroutput"><span class="identifier">accept</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">async_accept</span><span class="special">()</span></code> functions to allow a new connection to
be accepted directly into a socket of a more generic type. For example,
an <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">acceptor</span></code> can be used to accept into a
<code class="computeroutput"><span class="identifier">generic</span><span class="special">::</span><span class="identifier">stream_protocol</span><span class="special">::</span><span class="identifier">socket</span></code> object. For further information,
see <a class="link" href="overview/networking/other_protocols.html" title="Support for Other Protocols">Support for
Other Protocols</a>.
</li>
<li class="listitem">
Moved existing examples into a C++03-specific directory, and added a new
directory for C++11-specific examples. A limited subset of the C++03 examples
have been converted to their C++11 equivalents.
</li>
<li class="listitem">
Add the ability to use Asio without Boost, for a limited set of platforms.
When using a C++11 compiler, most of Asio may now be used without a dependency
on Boost header files or libraries. To use Asio in this way, define <code class="computeroutput"><span class="identifier">ASIO_STANDALONE</span></code> on your compiler command
line or as part of the project options. This standalone configuration has
currently been tested for the following platforms and compilers:
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
Linux with g++ 4.7 (requires <code class="literal">-std=c++11</code>)
</li>
<li class="listitem">
Mac OS X with clang++ / Xcode 4.6 (requires <code class="literal">-std=c++11 -stdlib=libc++</code>)
</li>
</ul></div>
</li>
<li class="listitem">
Various SSL enhancements. Thanks go to Nick Jones, on whose work these
changes are based.
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
Added support for SSL handshakes with re-use of data already read
from the wire. New overloads of the <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span><span class="special">&lt;&gt;</span></code> class's <code class="computeroutput"><span class="identifier">handshake</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">async_handshake</span><span class="special">()</span></code> functions have been added. These
accept a <code class="computeroutput"><span class="identifier">ConstBufferSequence</span></code>
to be used as initial input to the ssl engine for the handshake procedure.
</li>
<li class="listitem">
Added support for creation of TLSv1.1 and TLSv1.2 <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">context</span></code>
objects.
</li>
<li class="listitem">
Added a <code class="computeroutput"><span class="identifier">set_verify_depth</span><span class="special">()</span></code> function to the <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">context</span></code>
and <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span><span class="special">&lt;&gt;</span></code>
classes.
</li>
<li class="listitem">
Added the ability to load SSL certificate and key data from memory
buffers. New functions, <code class="computeroutput"><span class="identifier">add_certificate_authority</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">use_certificate</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">use_certificate_chain</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">use_private_key</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">use_rsa_private_key</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">use_tmp_dh</span><span class="special">()</span></code>, have been added to the <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">context</span></code> class.
</li>
<li class="listitem">
Changed <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">context</span></code> to automatically disable
SSL compression by default. To enable, use the new <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">context</span><span class="special">::</span><span class="identifier">clear_options</span><span class="special">()</span></code>
function, as in <code class="computeroutput"><span class="identifier">my_context</span><span class="special">.</span><span class="identifier">clear_options</span><span class="special">(</span><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">context</span><span class="special">::</span><span class="identifier">no_compression</span><span class="special">)</span></code>.
</li>
</ul></div>
</li>
<li class="listitem">
Fixed a potential deadlock in <code class="computeroutput"><span class="identifier">signal_set</span></code>
implementation.
</li>
<li class="listitem">
Fixed an error in acceptor example in documentation.
</li>
<li class="listitem">
Fixed copy-paste errors in waitable timer documentation.
</li>
<li class="listitem">
Added assertions to satisfy some code analysis tools.
</li>
<li class="listitem">
Fixed a malformed <code class="computeroutput"><span class="preprocessor">#warning</span></code>
directive.
</li>
<li class="listitem">
Fixed a potential data race in the Linux <code class="computeroutput"><span class="identifier">epoll</span></code>
implementation.
</li>
<li class="listitem">
Fixed a Windows-specific bug, where certain operations might generate an
<code class="computeroutput"><span class="identifier">error_code</span></code> with an invalid
(i.e. <code class="computeroutput"><span class="identifier">NULL</span></code>) <code class="computeroutput"><span class="identifier">error_category</span></code>.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">basic_waitable_timer</span></code>'s
underlying implementation so that it can handle any <code class="computeroutput"><span class="identifier">time_point</span></code>
value without overflowing the intermediate duration objects.
</li>
<li class="listitem">
Fixed a problem with lost thread wakeups that can occur when making concurrent
calls to <code class="computeroutput"><span class="identifier">run</span><span class="special">()</span></code>
and <code class="computeroutput"><span class="identifier">poll</span><span class="special">()</span></code>
on the same <code class="computeroutput"><span class="identifier">io_service</span></code>
object.
</li>
<li class="listitem">
Fixed implementation of asynchronous connect operation so that it can cope
with spurious readiness notifications from the reactor.
</li>
<li class="listitem">
Fixed a memory leak in the <code class="computeroutput"><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">rfc2818_verification</span></code>
class.
</li>
<li class="listitem">
Added a mechanism for disabling automatic Winsock initialisation. See the
header file <code class="literal">asio/detail/winsock_init.hpp</code> for details.
</li>
</ul></div>
<h4>
<a name="asio.history.h34"></a>
<span><a name="asio.history.asio_1_8_3"></a></span><a class="link" href="history.html#asio.history.asio_1_8_3">Asio
1.8.3</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Fixed some 64-to-32-bit conversion warnings.
</li>
<li class="listitem">
Fixed various small errors in documentation and comments.
</li>
<li class="listitem">
Fixed an error in the example embedded in <code class="computeroutput"><span class="identifier">basic_socket</span><span class="special">::</span><span class="identifier">get_option</span></code>'s
documentation.
</li>
<li class="listitem">
Changed to use <code class="computeroutput"><span class="keyword">long</span></code> rather
than <code class="computeroutput"><span class="keyword">int</span></code> for SSL_CTX options,
to match OpenSSL.
</li>
<li class="listitem">
Changed to use <code class="computeroutput"><span class="identifier">_snwprintf</span></code>
to address a compile error due to the changed <code class="computeroutput"><span class="identifier">swprintf</span></code>
signature in recent versions of MinGW.
</li>
<li class="listitem">
Fixed a deadlock that can occur on Windows when shutting down a pool of
<code class="computeroutput"><span class="identifier">io_service</span></code> threads due
to running out of work.
</li>
<li class="listitem">
Changed UNIX domain socket example to treat errors from <code class="computeroutput"><span class="identifier">accept</span></code>
as non-fatal.
</li>
<li class="listitem">
Added a small block recycling optimisation to improve default memory allocation
behaviour.
</li>
</ul></div>
<h4>
<a name="asio.history.h35"></a>
<span><a name="asio.history.asio_1_8_2"></a></span><a class="link" href="history.html#asio.history.asio_1_8_2">Asio
1.8.2</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Fixed an incompatibility between <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">iostream</span></code>
and C++11.
</li>
<li class="listitem">
Decorated GCC attribute names with underscores to prevent interaction with
user-defined macros.
</li>
<li class="listitem">
Added missing <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">cctype</span><span class="special">&gt;</span></code>, needed for some versions of MinGW.
</li>
<li class="listitem">
Changed to use <code class="literal">gcc</code>'s atomic builtins on ARM CPUs, when
available.
</li>
<li class="listitem">
Changed strand destruction to be a no-op, to allow strand objects to be
destroyed after their associated <code class="computeroutput"><span class="identifier">io_service</span></code>
has been destroyed.
</li>
<li class="listitem">
Added support for some newer versions of glibc which provide the <code class="computeroutput"><span class="identifier">epoll_create1</span><span class="special">()</span></code>
function but always fail with ENOSYS.
</li>
<li class="listitem">
Changed the SSL implementation to throw an exception if SSL engine initialisation
fails.
</li>
<li class="listitem">
Fixed another regression in <code class="computeroutput"><span class="identifier">buffered_write_stream</span></code>.
</li>
<li class="listitem">
Implemented various minor performance improvements, primarily targeted
at Linux x86 and x86-64 platforms.
</li>
</ul></div>
<h4>
<a name="asio.history.h36"></a>
<span><a name="asio.history.asio_1_8_1"></a></span><a class="link" href="history.html#asio.history.asio_1_8_1">Asio
1.8.1</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Changed the <code class="computeroutput"><span class="identifier">epoll_reactor</span></code>
backend to do lazy registration for <code class="computeroutput"><span class="identifier">EPOLLOUT</span></code>
events.
</li>
<li class="listitem">
Fixed the <code class="computeroutput"><span class="identifier">epoll_reactor</span></code>
handling of out-of-band data, which was broken by an incomplete fix in
the last release.
</li>
<li class="listitem">
Changed Asio's SSL wrapper to respect OpenSSL's <code class="computeroutput"><span class="identifier">OPENSSL_NO_ENGINE</span></code>
feature test <code class="computeroutput"><span class="preprocessor">#define</span></code>.
</li>
<li class="listitem">
Fixed <code class="computeroutput"><span class="identifier">windows</span><span class="special">::</span><span class="identifier">object_handle</span></code> so that it works with Windows
compilers that support C++11 move semantics (such as <code class="literal">g++</code>).
</li>
<li class="listitem">
Improved the performance of strand rescheduling.
</li>
<li class="listitem">
Added support for <code class="literal">g++</code> 4.7 when compiling in C++11 mode.
</li>
<li class="listitem">
Fixed a problem where <code class="computeroutput"><span class="identifier">signal_set</span></code>
handlers were not being delivered when the <code class="computeroutput"><span class="identifier">io_service</span></code>
was constructed with a <code class="computeroutput"><span class="identifier">concurrency_hint</span></code>
of 1.
</li>
</ul></div>
<h4>
<a name="asio.history.h37"></a>
<span><a name="asio.history.asio_1_8_0"></a></span><a class="link" href="history.html#asio.history.asio_1_8_0">Asio
1.8.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added a new class template <code class="computeroutput"><span class="identifier">basic_waitable_timer</span></code>
based around the C++11 clock type requirements. It may be used with the
clocks from the C++11 <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">chrono</span><span class="special">&gt;</span></code>
library facility or, if those are not available, Boost.Chrono. The typedefs
<code class="computeroutput"><span class="identifier">high_resolution_timer</span></code>,
<code class="computeroutput"><span class="identifier">steady_timer</span></code> and <code class="computeroutput"><span class="identifier">system_timer</span></code> may be used to create timer
objects for the standard clock types.
</li>
<li class="listitem">
Added a new <code class="computeroutput"><span class="identifier">windows</span><span class="special">::</span><span class="identifier">object_handle</span></code> class for performing waits
on Windows kernel objects. Thanks go to Boris Schaeling for contributing
substantially to the development of this feature.
</li>
<li class="listitem">
On Linux, <code class="computeroutput"><span class="identifier">connect</span><span class="special">()</span></code>
can return EAGAIN in certain circumstances. Remapped this to another error
so that it doesn't look like a non-blocking operation.
</li>
<li class="listitem">
Fixed a compile error on NetBSD.
</li>
<li class="listitem">
Fixed deadlock on Mac OS X.
</li>
<li class="listitem">
Fixed a regression in <code class="computeroutput"><span class="identifier">buffered_write_stream</span></code>.
</li>
<li class="listitem">
Fixed a non-paged pool "leak" on Windows when an <code class="computeroutput"><span class="identifier">io_service</span></code> is repeatedly run without
anything to do.
</li>
<li class="listitem">
Reverted earlier change to allow some speculative operations to be performed
without holding the lock, as it introduced a race condition in some multithreaded
scenarios.
</li>
<li class="listitem">
Fixed a bug where the second buffer in an array of two buffers may be ignored
if the first buffer is empty.
</li>
</ul></div>
<h4>
<a name="asio.history.h38"></a>
<span><a name="asio.history.asio_1_6_1"></a></span><a class="link" href="history.html#asio.history.asio_1_6_1">Asio
1.6.1</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Implemented various performance improvements, including:
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
Using thread-local operation queues in single-threaded use cases
(i.e. when <code class="computeroutput"><span class="identifier">concurrency_hint</span></code>
is 1) to eliminate a lock/unlock pair.
</li>
<li class="listitem">
Allowing some <code class="computeroutput"><span class="identifier">epoll_reactor</span></code>
speculative operations to be performed without holding the lock.
</li>
<li class="listitem">
Improving locality of reference by performing an <code class="computeroutput"><span class="identifier">epoll_reactor</span></code>'s
I/O operation immediately before the corresponding handler is called.
This also improves scalability across CPUs when multiple threads
are running the <code class="computeroutput"><span class="identifier">io_service</span></code>.
</li>
<li class="listitem">
Specialising asynchronous read and write operations for buffer sequences
that are arrays (<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">array</span></code>
or <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">array</span></code>) of exactly two buffers.
</li>
</ul></div>
</li>
<li class="listitem">
Fixed a compile error in the regex overload of <code class="computeroutput"><span class="identifier">async_read_until</span></code>.
</li>
<li class="listitem">
Fixed a Windows-specific compile error by explicitly specifying the <code class="computeroutput"><span class="identifier">signal</span><span class="special">()</span></code>
function from the global namespace.
</li>
<li class="listitem">
Changed the <code class="computeroutput"><span class="identifier">deadline_timer</span></code>
implementation so that it does not read the clock unless the timer heap
is non-empty.
</li>
<li class="listitem">
Changed the SSL stream's buffers' sizes so that they are large enough to
hold a complete TLS record.
</li>
<li class="listitem">
Fixed the behaviour of the synchronous <code class="computeroutput"><span class="identifier">null_buffers</span></code>
operations so that they obey the user's non-blocking setting.
</li>
<li class="listitem">
Changed to set the size of the select <code class="computeroutput"><span class="identifier">fd_set</span></code>
at runtime when using Windows.
</li>
<li class="listitem">
Disabled an MSVC warning due to const qualifier being applied to function
type.
</li>
<li class="listitem">
Fixed a crash that occurs when using the Intel C++ compiler.
</li>
<li class="listitem">
Changed the initialisation of the OpenSSL library so that it supports all
available algorithms.
</li>
<li class="listitem">
Fixed the SSL error mapping used when the session is gracefully shut down.
</li>
<li class="listitem">
Added some latency test programs.
</li>
<li class="listitem">
Clarified that a read operation ends when the buffer is full.
</li>
<li class="listitem">
Fixed an exception safety issue in <code class="computeroutput"><span class="identifier">epoll_reactor</span></code>
initialisation.
</li>
<li class="listitem">
Made the number of strand implementations configurable by defining <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_STRAND_IMPLEMENTATIONS</span></code>
to the desired number.
</li>
<li class="listitem">
Added support for a new <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION</span></code>
flag which switches the allocation of strand implementations to use a round-robin
approach rather than hashing.
</li>
<li class="listitem">
Fixed potential strand starvation issue that can occur when <code class="computeroutput"><span class="identifier">strand</span><span class="special">.</span><span class="identifier">post</span><span class="special">()</span></code>
is used.
</li>
</ul></div>
<h4>
<a name="asio.history.h39"></a>
<span><a name="asio.history.asio_1_6_0"></a></span><a class="link" href="history.html#asio.history.asio_1_6_0">Asio
1.6.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Improved support for C++0x move construction to further reduce copying
of handler objects. In certain designs it is possible to eliminate virtually
all copies. Move support is now enabled when compiling in <code class="literal">-std=c++0x</code>
mode on g++ 4.5 or higher.
</li>
<li class="listitem">
Added build support for platforms that don't provide either of <code class="computeroutput"><span class="identifier">signal</span><span class="special">()</span></code>
or <code class="computeroutput"><span class="identifier">sigaction</span><span class="special">()</span></code>.
</li>
<li class="listitem">
Changed to use C++0x variadic templates when they are available, rather
than generating function overloads using the Boost.Preprocessor library.
</li>
<li class="listitem">
Ensured the value of <code class="computeroutput"><span class="identifier">errno</span></code>
is preserved across the implementation's signal handler.
</li>
<li class="listitem">
On Windows, ensured the count of outstanding work is decremented for abandoned
operations (i.e. operations that are being cleaned up within the <code class="computeroutput"><span class="identifier">io_service</span></code> destructor).
</li>
<li class="listitem">
Fixed behaviour of zero-length reads and writes in the new SSL implementation.
</li>
<li class="listitem">
Added support for building with OpenSSL 1.0 when <code class="computeroutput"><span class="identifier">OPENSSL_NO_SSL2</span></code>
is defined.
</li>
<li class="listitem">
Changed most examples to treat a failure by an accept operation as non-fatal.
</li>
<li class="listitem">
Fixed an error in the <code class="literal">tick_count_timer</code> example by making
the duration type signed. Previously, a wait on an already-passed deadline
would not return for a very long time.
</li>
</ul></div>
<h4>
<a name="asio.history.h40"></a>
<span><a name="asio.history.asio_1_5_3"></a></span><a class="link" href="history.html#asio.history.asio_1_5_3">Asio
1.5.3</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added a new, completely rewritten SSL implementation. The new implementation
compiles faster, shows substantially improved performance, and supports
custom memory allocation and handler invocation. It includes new API features
such as certificate verification callbacks and has improved error reporting.
The new implementation is source-compatible with the old for most uses.
However, if necessary, the old implementation may still be used by defining
<code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_ENABLE_OLD_SSL</span></code>.
</li>
<li class="listitem">
Added new <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">()</span></code>
overloads for <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">array</span></code>, when available. The support is
automatically enabled when compiling in <code class="literal">-std=c++0x</code> mode
on g++ 4.3 or higher, or when using MSVC 10. The support may be explicitly
enabled by defining <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_HAS_STD_ARRAY</span></code>,
or disabled by defining <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_DISABLE_STD_ARRAY</span></code>.
</li>
<li class="listitem">
Changed to use the C++0x standard library templates <code class="computeroutput"><span class="identifier">array</span></code>,
<code class="computeroutput"><span class="identifier">shared_ptr</span></code>, <code class="computeroutput"><span class="identifier">weak_ptr</span></code> and <code class="computeroutput"><span class="identifier">atomic</span></code>
when they are available, rather than the Boost equivalents.
</li>
<li class="listitem">
Support for <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">error_code</span></code> and <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">system_error</span></code>
is no longer enabled by default for g++ 4.5, as that compiler's standard
library does not implement <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">system_error</span><span class="special">::</span><span class="identifier">what</span><span class="special">()</span></code> correctly.
</li>
</ul></div>
<h4>
<a name="asio.history.h41"></a>
<span><a name="asio.history.asio_1_5_2"></a></span><a class="link" href="history.html#asio.history.asio_1_5_2">Asio
1.5.2</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added support for C++0x move construction and assignment to sockets, serial
ports, POSIX descriptors and Windows handles.
</li>
<li class="listitem">
Added support for the <code class="computeroutput"><span class="identifier">fork</span><span class="special">()</span></code> system call. Programs that use <code class="computeroutput"><span class="identifier">fork</span><span class="special">()</span></code>
must call <code class="computeroutput"><span class="identifier">io_service</span><span class="special">.</span><span class="identifier">notify_fork</span><span class="special">()</span></code>
at the appropriate times. Two new examples have been added showing how
to use this feature.
</li>
<li class="listitem">
Cleaned up the handling of errors reported by the <code class="computeroutput"><span class="identifier">close</span><span class="special">()</span></code> system call. In particular, assume that
most operating systems won't have <code class="computeroutput"><span class="identifier">close</span><span class="special">()</span></code> fail with <code class="computeroutput"><span class="identifier">EWOULDBLOCK</span></code>,
but if it does then set the blocking mode and restart the call. If any
other error occurs, assume the descriptor is closed.
</li>
<li class="listitem">
The kqueue flag <code class="computeroutput"><span class="identifier">EV_ONESHOT</span></code>
seems to cause problems on some versions of Mac OS X, with the <code class="computeroutput"><span class="identifier">io_service</span></code> destructor getting stuck inside
the <code class="computeroutput"><span class="identifier">close</span><span class="special">()</span></code>
system call. Changed the kqueue backend to use <code class="computeroutput"><span class="identifier">EV_CLEAR</span></code>
instead.
</li>
<li class="listitem">
Changed exception reporting to include the function name in exception
<code class="computeroutput"><span class="identifier">what</span><span class="special">()</span></code>
messages.
</li>
<li class="listitem">
Fixed an insufficient initialisers warning with MinGW.
</li>
<li class="listitem">
Changed the <code class="computeroutput"><span class="identifier">shutdown_service</span><span class="special">()</span></code> member functions to be private.
</li>
<li class="listitem">
Added archetypes for testing socket option functions.
</li>
<li class="listitem">
Added a missing lock in <code class="computeroutput"><span class="identifier">signal_set_service</span><span class="special">::</span><span class="identifier">cancel</span><span class="special">()</span></code>.
</li>
<li class="listitem">
Fixed a copy/paste error in <code class="computeroutput"><span class="identifier">SignalHandler</span></code>
example.
</li>
<li class="listitem">
Added the inclusion of the signal header to <code class="computeroutput"><span class="identifier">signal_set_service</span><span class="special">.</span><span class="identifier">hpp</span></code>
so that constants like <code class="computeroutput"><span class="identifier">NSIG</span></code>
may be used.
</li>
<li class="listitem">
Changed the <code class="computeroutput"><span class="identifier">signal_set_service</span></code>
implementation so that it doesn't assume that <code class="computeroutput"><span class="identifier">SIGRTMAX</span></code>
is a compile-time constant.
</li>
<li class="listitem">
Changed the Boost.Asio examples so that they don't use Boost.Thread's convenience
header. Use the header file that is specifically for the boost::thread
class instead.
</li>
</ul></div>
<h4>
<a name="asio.history.h42"></a>
<span><a name="asio.history.asio_1_5_1"></a></span><a class="link" href="history.html#asio.history.asio_1_5_1">Asio
1.5.1</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added support for signal handling, using a new class called <code class="computeroutput"><span class="identifier">signal_set</span></code>. Programs may add one or more
signals to the set, and then perform an <code class="computeroutput"><span class="identifier">async_wait</span><span class="special">()</span></code> operation. The specified handler will
be called when one of the signals occurs. The same signal number may registered
with multiple <code class="computeroutput"><span class="identifier">signal_set</span></code>
objects, however the signal number must be used only with Asio.
</li>
<li class="listitem">
Added handler tracking, a new debugging aid. When enabled by defining
<code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_ENABLE_HANDLER_TRACKING</span></code>,
Asio writes debugging output to the standard error stream. The output records
asynchronous operations and the relationships between their handlers. It
may be post-processed using the included <code class="literal">handlerviz.pl</code>
tool to create a visual representation of the handlers (requires GraphViz).
</li>
<li class="listitem">
Fixed a bug in <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">streambuf</span></code> where the <code class="computeroutput"><span class="identifier">consume</span><span class="special">()</span></code> function did not always update the internal
buffer pointers correctly. The problem may occur when the <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">streambuf</span></code> is filled with data using the
standard C++ member functions such as <code class="computeroutput"><span class="identifier">sputn</span><span class="special">()</span></code>. (Note: the problem does not manifest
when the streambuf is populated by the Asio free functions <code class="computeroutput"><span class="identifier">read</span><span class="special">()</span></code>,
<code class="computeroutput"><span class="identifier">async_read</span><span class="special">()</span></code>,
<code class="computeroutput"><span class="identifier">read_until</span><span class="special">()</span></code>
or <code class="computeroutput"><span class="identifier">async_read_until</span><span class="special">()</span></code>.)
</li>
<li class="listitem">
Fixed a bug on kqueue-based platforms, where reactor read operations that
return false from their <code class="computeroutput"><span class="identifier">perform</span><span class="special">()</span></code> function are not correctly re-registered
with kqueue.
</li>
<li class="listitem">
Support for <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">error_code</span></code> and <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">system_error</span></code>
is no longer enabled by default for MSVC10, as that compiler's standard
library does not implement <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">system_error</span><span class="special">::</span><span class="identifier">what</span><span class="special">()</span></code> correctly.
</li>
<li class="listitem">
Modified the <code class="computeroutput"><span class="identifier">buffers_iterator</span><span class="special">&lt;&gt;</span></code> and <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_resolver_iterator</span></code>
classes so that the value_type typedefs are non-const byte types.
</li>
</ul></div>
<h4>
<a name="asio.history.h43"></a>
<span><a name="asio.history.asio_1_5_0"></a></span><a class="link" href="history.html#asio.history.asio_1_5_0">Asio
1.5.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added support for timeouts on socket iostreams, such as <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">iostream</span></code>.
A timeout is set by calling <code class="computeroutput"><span class="identifier">expires_at</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">expires_from_now</span><span class="special">()</span></code> to establish a deadline. Any socket operations
which occur past the deadline will put the iostream into a bad state.
</li>
<li class="listitem">
Added a new <code class="computeroutput"><span class="identifier">error</span><span class="special">()</span></code>
member function to socket iostreams, for retrieving the error code from
the most recent system call.
</li>
<li class="listitem">
Added a new <code class="computeroutput"><span class="identifier">basic_deadline_timer</span><span class="special">::</span><span class="identifier">cancel_one</span><span class="special">()</span></code> function. This function lets you cancel
a single waiting handler on a timer. Handlers are cancelled in FIFO order.
</li>
<li class="listitem">
Added a new <code class="computeroutput"><span class="identifier">transfer_exactly</span><span class="special">()</span></code> completion condition. This can be used
to send or receive a specified number of bytes even if the total size of
the buffer (or buffer sequence) is larger.
</li>
<li class="listitem">
Added new free functions <code class="computeroutput"><span class="identifier">connect</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">async_connect</span><span class="special">()</span></code>. These operations try each endpoint in
a list until the socket is successfully connected.
</li>
<li class="listitem">
Extended the <code class="computeroutput"><span class="identifier">buffer_size</span><span class="special">()</span></code> function so that it works for buffer
sequences in addition to individual buffers.
</li>
<li class="listitem">
Added a new <code class="computeroutput"><span class="identifier">buffer_copy</span><span class="special">()</span></code> function that can be used to copy the
raw bytes between individual buffers and buffer sequences.
</li>
<li class="listitem">
Added new non-throwing overloads of <code class="computeroutput"><span class="identifier">read</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">read_at</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">write</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">write_at</span><span class="special">()</span></code> that do not require a completion condition.
</li>
<li class="listitem">
Added friendlier compiler errors for when a completion handler does not
meet the necessary type requirements. When C++0x is available (currently
supported for g++ 4.5 or later, and MSVC 10), <code class="computeroutput"><span class="keyword">static_assert</span></code>
is also used to generate an informative error message. This checking may
be disabled by defining <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS</span></code>.
</li>
<li class="listitem">
Added support for using <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">error_code</span></code>
and <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">system_error</span></code>, when available. The support
is automatically enabled when compiling in <code class="literal">-std=c++0x</code>
mode on g++ 4.5 or higher, or when using MSVC 10. The support may be explicitly
enabled by defining <code class="computeroutput"><span class="identifier">ASIO_HAS_STD_SYSTEM_ERROR</span></code>,
or disabled by defining <code class="computeroutput"><span class="identifier">ASIO_DISABLE_STD_SYSTEM_ERROR</span></code>.
(Available in non-Boost version of Asio only.)
</li>
<li class="listitem">
Made the <code class="computeroutput"><span class="identifier">is_loopback</span><span class="special">()</span></code>,
<code class="computeroutput"><span class="identifier">is_unspecified</span><span class="special">()</span></code>
and <code class="computeroutput"><span class="identifier">is_multicast</span><span class="special">()</span></code>
functions consistently available across the <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">address</span></code>,
<code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">address_v4</span></code> and <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">address_v6</span></code>
classes.
</li>
<li class="listitem">
Added new <code class="computeroutput"><span class="identifier">non_blocking</span><span class="special">()</span></code> functions for managing the non-blocking
behaviour of a socket or descriptor. The <code class="computeroutput"><span class="identifier">io_control</span><span class="special">()</span></code> commands named <code class="computeroutput"><span class="identifier">non_blocking_io</span></code>
are now deprecated in favour of these new functions.
</li>
<li class="listitem">
Added new <code class="computeroutput"><span class="identifier">native_non_blocking</span><span class="special">()</span></code> functions for managing the non-blocking
mode of the underlying socket or descriptor. These functions are intended
to allow the encapsulation of arbitrary non-blocking system calls as asynchronous
operations, in a way that is transparent to the user of the socket object.
The functions have no effect on the behaviour of the synchronous operations
of the socket or descriptor.
</li>
<li class="listitem">
Added the <code class="computeroutput"><span class="identifier">io_control</span><span class="special">()</span></code>
member function for socket acceptors.
</li>
<li class="listitem">
For consistency with the C++0x standard library, deprecated the <code class="computeroutput"><span class="identifier">native_type</span></code> typedefs in favour of <code class="computeroutput"><span class="identifier">native_handle_type</span></code>, and the <code class="computeroutput"><span class="identifier">native</span><span class="special">()</span></code>
member functions in favour of <code class="computeroutput"><span class="identifier">native_handle</span><span class="special">()</span></code>.
</li>
<li class="listitem">
Added a <code class="computeroutput"><span class="identifier">release</span><span class="special">()</span></code>
member function to posix descriptors. This function releases ownership
of the underlying native descriptor to the caller.
</li>
<li class="listitem">
Added support for sequenced packet sockets (<code class="computeroutput"><span class="identifier">SOCK_SEQPACKET</span></code>).
</li>
<li class="listitem">
Added a new <code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">stopped</span><span class="special">()</span></code> function that can be used to determine
whether the <code class="computeroutput"><span class="identifier">io_service</span></code>
has stopped (i.e. a <code class="computeroutput"><span class="identifier">reset</span><span class="special">()</span></code> call is needed prior to any further calls
to <code class="computeroutput"><span class="identifier">run</span><span class="special">()</span></code>,
<code class="computeroutput"><span class="identifier">run_one</span><span class="special">()</span></code>,
<code class="computeroutput"><span class="identifier">poll</span><span class="special">()</span></code>
or <code class="computeroutput"><span class="identifier">poll_one</span><span class="special">()</span></code>).
</li>
<li class="listitem">
Reduced the copying of handler function objects.
</li>
<li class="listitem">
Added support for C++0x move construction to further reduce copying of
handler objects. Move support is enabled when compiling in <code class="literal">-std=c++0x</code>
mode on g++ 4.5 or higher, or when using MSVC10.
</li>
<li class="listitem">
Removed the dependency on OS-provided macros for the well-known IPv4 and
IPv6 addresses. This should eliminate the annoying "missing braces
around initializer" warnings.
</li>
<li class="listitem">
Reduced the size of <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">basic_endpoint</span><span class="special">&lt;&gt;</span></code> objects (such as <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">endpoint</span></code> and <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span><span class="special">::</span><span class="identifier">endpoint</span></code>).
</li>
<li class="listitem">
Changed the reactor backends to assume that any descriptors or sockets
added using <code class="computeroutput"><span class="identifier">assign</span><span class="special">()</span></code>
may have been <code class="computeroutput"><span class="identifier">dup</span><span class="special">()</span></code>-ed,
and so require explicit deregistration from the reactor.
</li>
<li class="listitem">
Changed the SSL error category to return error strings from the OpenSSL
library.
</li>
<li class="listitem">
Changed the separate compilation support such that, to use Asio's SSL capabilities,
you should also include 'asio/ssl/impl/src.hpp` in one source file in your
program.
</li>
<li class="listitem">
Removed the deprecated member functions named <code class="computeroutput"><span class="identifier">io_service</span><span class="special">()</span></code>. The <code class="computeroutput"><span class="identifier">get_io_service</span><span class="special">()</span></code> member functions should be used instead.
</li>
<li class="listitem">
Removed the deprecated typedefs <code class="computeroutput"><span class="identifier">resolver_query</span></code>
and <code class="computeroutput"><span class="identifier">resolver_iterator</span></code> from
the <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span></code>, <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span></code>
and <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">icmp</span></code> classes.
</li>
<li class="listitem">
Fixed a compile error on some versions of g++ due to anonymous enums.
</li>
<li class="listitem">
Added an explicit cast to the <code class="computeroutput"><span class="identifier">FIONBIO</span></code>
constant to int to suppress a compiler warning on some platforms.
</li>
<li class="listitem">
Fixed warnings reported by g++'s <code class="literal">-Wshadow</code> compiler option.
</li>
</ul></div>
<h4>
<a name="asio.history.h44"></a>
<span><a name="asio.history.asio_1_4_8"></a></span><a class="link" href="history.html#asio.history.asio_1_4_8">Asio
1.4.8</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Fixed an integer overflow problem that occurs when <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">address_v4</span><span class="special">::</span><span class="identifier">broadcast</span><span class="special">()</span></code> is used on 64-bit platforms.
</li>
<li class="listitem">
Fixed a problem on older Linux kernels (where epoll is used without <code class="computeroutput"><span class="identifier">timerfd</span></code> support) that prevents timely
delivery of <code class="computeroutput"><span class="identifier">deadline_timer</span></code>
handlers, after the program has been running for some time.
</li>
</ul></div>
<h4>
<a name="asio.history.h45"></a>
<span><a name="asio.history.asio_1_4_7"></a></span><a class="link" href="history.html#asio.history.asio_1_4_7">Asio
1.4.7</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Fixed a problem on kqueue-based platforms where a <code class="computeroutput"><span class="identifier">deadline_timer</span></code>
may never fire if the <code class="computeroutput"><span class="identifier">io_service</span></code>
is running in a background thread.
</li>
<li class="listitem">
Fixed a const-correctness issue that prevented valid uses of <code class="computeroutput"><span class="identifier">has_service</span><span class="special">&lt;&gt;</span></code>
from compiling.
</li>
<li class="listitem">
Fixed MinGW cross-compilation.
</li>
<li class="listitem">
Removed dependency on deprecated Boost.System functions (Boost.Asio only).
</li>
<li class="listitem">
Ensured <code class="computeroutput"><span class="identifier">close</span><span class="special">()</span></code>/<code class="computeroutput"><span class="identifier">closesocket</span><span class="special">()</span></code>
failures are correctly propagated.
</li>
<li class="listitem">
Added a check for errors returned by <code class="computeroutput"><span class="identifier">InitializeCriticalSectionAndSpinCount</span></code>.
</li>
<li class="listitem">
Added support for hardware flow control on QNX.
</li>
<li class="listitem">
Always use <code class="computeroutput"><span class="identifier">pselect</span><span class="special">()</span></code>
on HP-UX, if it is available.
</li>
<li class="listitem">
Ensured handler arguments are passed as lvalues.
</li>
<li class="listitem">
Fixed Windows build when thread support is disabled.
</li>
<li class="listitem">
Fixed a Windows-specific problem where <code class="computeroutput"><span class="identifier">deadline_timer</span></code>
objects with expiry times set more than 5 minutes in the future may never
expire.
</li>
<li class="listitem">
Fixed the resolver backend on BSD platforms so that an empty service name
resolves to port number <code class="computeroutput"><span class="number">0</span></code>,
as per the documentation.
</li>
<li class="listitem">
Fixed read operations so that they do not accept buffer sequences of type
<code class="computeroutput"><span class="identifier">const_buffers_1</span></code>.
</li>
<li class="listitem">
Redefined <code class="computeroutput"><span class="identifier">Protocol</span></code> and
<code class="computeroutput"><span class="identifier">id</span></code> to avoid clashing with
Objective-C++ keywords.
</li>
<li class="listitem">
Fixed a <code class="computeroutput"><span class="identifier">vector</span></code> reallocation
performance issue that can occur when there are many active <code class="computeroutput"><span class="identifier">deadline_timer</span></code> objects.
</li>
<li class="listitem">
Fixed the kqueue backend so that it compiles on NetBSD.
</li>
<li class="listitem">
Fixed the socket <code class="computeroutput"><span class="identifier">io_control</span><span class="special">()</span></code> implementation on 64-bit Mac OS X and
BSD platforms.
</li>
<li class="listitem">
Fixed a Windows-specific problem where failures from <code class="computeroutput"><span class="identifier">accept</span><span class="special">()</span></code> are incorrectly treated as successes.
</li>
<li class="listitem">
Deprecated the separate compilation header <code class="computeroutput"><span class="identifier">asio</span><span class="special">/</span><span class="identifier">impl</span><span class="special">/</span><span class="identifier">src</span><span class="special">.</span><span class="identifier">cpp</span></code>
in favour of <code class="computeroutput"><span class="identifier">asio</span><span class="special">/</span><span class="identifier">impl</span><span class="special">/</span><span class="identifier">src</span><span class="special">.</span><span class="identifier">hpp</span></code>.
</li>
</ul></div>
<h4>
<a name="asio.history.h46"></a>
<span><a name="asio.history.asio_1_4_6"></a></span><a class="link" href="history.html#asio.history.asio_1_4_6">Asio
1.4.6</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Reduced compile times. (Note that some programs may need to add additional
<code class="computeroutput"><span class="preprocessor">#include</span></code>s, e.g. if the
program uses boost::array but does not explicitly include <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">array</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>.)
</li>
<li class="listitem">
Reduced the size of generated code.
</li>
<li class="listitem">
Refactored <code class="computeroutput"><span class="identifier">deadline_timer</span></code>
implementation to improve performance.
</li>
<li class="listitem">
Improved multiprocessor scalability on Windows by using a dedicated hidden
thread to wait for timers.
</li>
<li class="listitem">
Improved performance of <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">streambuf</span></code>
with <code class="computeroutput"><span class="identifier">async_read</span><span class="special">()</span></code>
and <code class="computeroutput"><span class="identifier">async_read_until</span><span class="special">()</span></code>.
These read operations now use the existing capacity of the <code class="computeroutput"><span class="identifier">streambuf</span></code> when reading, rather than limiting
the read to 512 bytes.
</li>
<li class="listitem">
Added optional separate compilation. To enable, include <code class="computeroutput"><span class="identifier">asio</span><span class="special">/</span><span class="identifier">impl</span><span class="special">/</span><span class="identifier">src</span><span class="special">.</span><span class="identifier">cpp</span></code>
in one source file in a program, then build the program with <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_SEPARATE_COMPILATION</span></code>
defined in the project/compiler settings. Alternatively, <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_DYN_LINK</span></code>
may be defined to build a separately-compiled Asio as part of a shared
library.
</li>
<li class="listitem">
Added new macro <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_DISABLE_FENCED_BLOCK</span></code>
to permit the disabling of memory fences around completion handlers, even
if thread support is enabled.
</li>
<li class="listitem">
Reworked timeout examples to better illustrate typical use cases.
</li>
<li class="listitem">
Ensured that handler arguments are passed as const types.
</li>
<li class="listitem">
Fixed incorrect parameter order in <code class="computeroutput"><span class="identifier">null_buffers</span></code>
variant of <code class="computeroutput"><span class="identifier">async_send_to</span></code>.
</li>
<li class="listitem">
Ensured unsigned char is used with <code class="computeroutput"><span class="identifier">isdigit</span></code>
in <code class="computeroutput"><span class="identifier">getaddrinfo</span></code> emulation.
</li>
<li class="listitem">
Fixed handling of very small but non-zero timeouts.
</li>
<li class="listitem">
Fixed crash that occurred when an empty buffer sequence was passed to a
composed read or write operation.
</li>
<li class="listitem">
Added missing operator+ overload in <code class="computeroutput"><span class="identifier">buffers_iterator</span></code>.
</li>
<li class="listitem">
Implemented cancellation of <code class="computeroutput"><span class="identifier">null_buffers</span></code>
operations on Windows.
</li>
</ul></div>
<h4>
<a name="asio.history.h47"></a>
<span><a name="asio.history.asio_1_4_5"></a></span><a class="link" href="history.html#asio.history.asio_1_4_5">Asio
1.4.5</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Improved performance.
</li>
<li class="listitem">
Reduced compile times.
</li>
<li class="listitem">
Reduced the size of generated code.
</li>
<li class="listitem">
Extended the guarantee that background threads don't call user code to
all asynchronous operations.
</li>
<li class="listitem">
Changed to use edge-triggered epoll on Linux.
</li>
<li class="listitem">
Changed to use <code class="computeroutput"><span class="identifier">timerfd</span></code>
for dispatching timers on Linux, when available.
</li>
<li class="listitem">
Changed to use one-shot notifications with kqueue on Mac OS X and BSD platforms.
</li>
<li class="listitem">
Added a bitmask type <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">resolver_query_base</span><span class="special">::</span><span class="identifier">flags</span></code>
as per the TR2 proposal. This type prevents implicit conversion from <code class="computeroutput"><span class="keyword">int</span></code> to <code class="computeroutput"><span class="identifier">flags</span></code>,
allowing the compiler to catch cases where users incorrectly pass a numeric
port number as the service name.
</li>
<li class="listitem">
Added <code class="computeroutput"><span class="preprocessor">#define</span> <span class="identifier">NOMINMAX</span></code>
for all Windows compilers. Users can define <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_NO_NOMINMAX</span></code> to suppress this definition.
</li>
<li class="listitem">
Fixed a bug where 0-byte asynchronous reads were incorrectly passing an
<code class="computeroutput"><span class="identifier">error</span><span class="special">::</span><span class="identifier">eof</span></code> result to the completion handler.
</li>
<li class="listitem">
Changed the <code class="computeroutput"><span class="identifier">io_control</span><span class="special">()</span></code> member functions to always call <code class="computeroutput"><span class="identifier">ioctl</span></code> on the underlying descriptor when
modifying blocking mode.
</li>
<li class="listitem">
Changed the resolver implementation so that it no longer requires the typedefs
<code class="computeroutput"><span class="identifier">InternetProtocol</span><span class="special">::</span><span class="identifier">resolver_query</span></code> and <code class="computeroutput"><span class="identifier">InternetProtocol</span><span class="special">::</span><span class="identifier">resolver_iterator</span></code>,
as neither typedef is part of the documented <code class="computeroutput"><span class="identifier">InternetProtocol</span></code>
requirements. The corresponding typedefs in the <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span></code>,
<code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">udp</span></code> and <code class="computeroutput"><span class="identifier">ip</span><span class="special">::</span><span class="identifier">icmp</span></code>
classes have been deprecated.
</li>
<li class="listitem">
Fixed out-of-band handling for reactors not based on <code class="computeroutput"><span class="identifier">select</span><span class="special">()</span></code>.
</li>
<li class="listitem">
Added new <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_DISABLE_THREADS</span></code>
macro that allows Asio's threading support to be independently disabled.
</li>
<li class="listitem">
Minor documentation improvements.
</li>
</ul></div>
<h4>
<a name="asio.history.h48"></a>
<span><a name="asio.history.asio_1_4_4"></a></span><a class="link" href="history.html#asio.history.asio_1_4_4">Asio
1.4.4</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added a new HTTP Server 4 example illustrating the use of stackless coroutines
with Asio.
</li>
<li class="listitem">
Changed handler allocation and invocation to use <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">addressof</span></code>
to get the address of handler objects, rather than applying <code class="computeroutput"><span class="keyword">operator</span><span class="special">&amp;</span></code>
directly.
</li>
<li class="listitem">
Restricted MSVC buffer debugging workaround to 2008, as it causes a crash
with 2010 beta 2.
</li>
<li class="listitem">
Fixed a problem with the lifetime of handler memory, where Windows needs
the <code class="computeroutput"><span class="identifier">OVERLAPPED</span></code> structure
to be valid until both the initiating function call has returned and the
completion packet has been delivered.
</li>
<li class="listitem">
Don't block signals while performing system calls, but instead restart
the calls if they are interrupted.
</li>
<li class="listitem">
Documented the guarantee made by strand objects with respect to order of
handler invocation.
</li>
<li class="listitem">
Changed strands to use a pool of implementations, to make copying of strands
cheaper.
</li>
<li class="listitem">
Ensured that kqueue support is enabled for BSD platforms.
</li>
<li class="listitem">
Added a <code class="computeroutput"><span class="identifier">boost_</span></code> prefix to
the <code class="computeroutput"><span class="keyword">extern</span> <span class="string">"C"</span></code>
thread entry point function.
</li>
<li class="listitem">
In <code class="computeroutput"><span class="identifier">getaddrinfo</span></code> emulation,
only check the socket type (<code class="computeroutput"><span class="identifier">SOCK_STREAM</span></code>
or <code class="computeroutput"><span class="identifier">SOCK_DGRAM</span></code>) if a service
name has been specified. This should allow the emulation to work with raw
sockets.
</li>
<li class="listitem">
Added a workaround for some broken Windows firewalls that make a socket
appear bound to 0.0.0.0 when it is in fact bound to 127.0.0.1.
</li>
<li class="listitem">
Applied a fix for reported excessive CPU usage under Solaris.
</li>
<li class="listitem">
Added some support for platforms that use older compilers such as g++ 2.95.
</li>
</ul></div>
<h4>
<a name="asio.history.h49"></a>
<span><a name="asio.history.asio_1_4_3"></a></span><a class="link" href="history.html#asio.history.asio_1_4_3">Asio
1.4.3</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added a new ping example to illustrate the use of ICMP sockets.
</li>
<li class="listitem">
Changed the <code class="computeroutput"><span class="identifier">buffered</span><span class="special">*</span><span class="identifier">_stream</span><span class="special">&lt;&gt;</span></code>
templates to treat 0-byte reads and writes as no-ops, to comply with the
documented type requirements for <code class="computeroutput"><span class="identifier">SyncReadStream</span></code>,
<code class="computeroutput"><span class="identifier">AsyncReadStream</span></code>, <code class="computeroutput"><span class="identifier">SyncWriteStream</span></code> and <code class="computeroutput"><span class="identifier">AsyncWriteStream</span></code>.
</li>
<li class="listitem">
Changed some instances of the <code class="computeroutput"><span class="keyword">throw</span></code>
keyword to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">throw_exception</span><span class="special">()</span></code>
to allow Asio to be used when exception support is disabled. Note that
the SSL wrappers still require exception support.
</li>
<li class="listitem">
Made Asio compatible with the OpenSSL 1.0 beta.
</li>
<li class="listitem">
Eliminated a redundant system call in the Solaris /dev/poll backend.
</li>
<li class="listitem">
Fixed a bug in resizing of the bucket array in the internal hash maps.
</li>
<li class="listitem">
Ensured correct propagation of the error code when a synchronous accept
fails.
</li>
<li class="listitem">
Ensured correct propagation of the error code when a synchronous read or
write on a Windows <code class="computeroutput"><span class="identifier">HANDLE</span></code>
fails.
</li>
<li class="listitem">
Fixed failures reported when <code class="computeroutput"><span class="identifier">_GLIBCXX_DEBUG</span></code>
is defined.
</li>
<li class="listitem">
Fixed custom memory allocation support for timers.
</li>
<li class="listitem">
Tidied up various warnings reported by g++.
</li>
<li class="listitem">
Various documentation improvements, including more obvious hyperlinks to
function overloads, header file information, examples for the handler type
requirements, and adding enum values to the index.
</li>
</ul></div>
<h4>
<a name="asio.history.h50"></a>
<span><a name="asio.history.asio_1_4_2"></a></span><a class="link" href="history.html#asio.history.asio_1_4_2">Asio
1.4.2</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Implement automatic resizing of the bucket array in the internal hash maps.
This is to improve performance for very large numbers of asynchronous operations
and also to reduce memory usage for very small numbers. A new macro <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_HASH_MAP_BUCKETS</span></code>
may be used to tweak the sizes used for the bucket arrays. (N.B. this feature
introduced a bug which was fixed in Asio 1.4.3 / Boost 1.40.)
</li>
<li class="listitem">
Add performance optimisation for the Windows IOCP backend for when no timers
are used.
</li>
<li class="listitem">
Prevent locale settings from affecting formatting of TCP and UDP endpoints.
</li>
<li class="listitem">
Fix a memory leak that occurred when an asynchronous SSL operation's completion
handler threw an exception.
</li>
<li class="listitem">
Fix the implementation of <code class="computeroutput"><span class="identifier">io_control</span><span class="special">()</span></code> so that it adheres to the documented
type requirements for IoControlCommand.
</li>
<li class="listitem">
Fix incompatibility between Asio and ncurses.h.
</li>
<li class="listitem">
On Windows, specifically handle the case when an overlapped <code class="computeroutput"><span class="identifier">ReadFile</span></code> call fails with <code class="computeroutput"><span class="identifier">ERROR_MORE_DATA</span></code>. This enables a hack
where a <code class="computeroutput"><span class="identifier">windows</span><span class="special">::</span><span class="identifier">stream_handle</span></code> can be used with a message-oriented
named pipe.
</li>
<li class="listitem">
Fix system call wrappers to always clear the error on success, as POSIX
allows successful system calls to modify errno.
</li>
<li class="listitem">
Don't include termios.h if <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_DISABLE_SERIAL_PORT</span></code> is defined.
</li>
<li class="listitem">
Cleaned up some more MSVC level 4 warnings.
</li>
<li class="listitem">
Various documentation fixes.
</li>
</ul></div>
<h4>
<a name="asio.history.h51"></a>
<span><a name="asio.history.asio_1_4_1"></a></span><a class="link" href="history.html#asio.history.asio_1_4_1">Asio
1.4.1</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Improved compatibility with some Windows firewall software.
</li>
<li class="listitem">
Ensured arguments to <code class="computeroutput"><span class="identifier">windows</span><span class="special">::</span><span class="identifier">overlapped_ptr</span><span class="special">::</span><span class="identifier">complete</span><span class="special">()</span></code> are correctly passed to the completion
handler.
</li>
<li class="listitem">
Fixed a link problem and multicast failure on QNX.
</li>
<li class="listitem">
Fixed a compile error in SSL support on MinGW / g++ 3.4.5.
</li>
<li class="listitem">
Drop back to using a pipe for notification if eventfd is not available
at runtime on Linux.
</li>
<li class="listitem">
Various minor bug and documentation fixes.
</li>
</ul></div>
<h4>
<a name="asio.history.h52"></a>
<span><a name="asio.history.asio_1_4_0"></a></span><a class="link" href="history.html#asio.history.asio_1_4_0">Asio
1.4.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Enhanced CompletionCondition concept with the signature <code class="computeroutput"><span class="identifier">size_t</span>
<span class="identifier">CompletionCondition</span><span class="special">(</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">total</span><span class="special">)</span></code>,
where the return value indicates the maximum number of bytes to be transferred
on the next read or write operation. (The old CompletionCondition signature
is still supported for backwards compatibility).
</li>
<li class="listitem">
New <code class="computeroutput"><span class="identifier">windows</span><span class="special">::</span><span class="identifier">overlapped_ptr</span></code> class to allow arbitrary
overlapped I/O functions (such as <code class="computeroutput"><span class="identifier">TransmitFile</span></code>)
to be used with Asio.
</li>
<li class="listitem">
On recent versions of Linux, an <code class="computeroutput"><span class="identifier">eventfd</span></code>
descriptor is now used (rather than a pipe) to interrupt a blocked select/epoll
reactor.
</li>
<li class="listitem">
Added const overloads of <code class="computeroutput"><span class="identifier">lowest_layer</span><span class="special">()</span></code>.
</li>
<li class="listitem">
Synchronous read, write, accept and connect operations are now thread safe
(meaning that it is now permitted to perform concurrent synchronous operations
on an individual socket, if supported by the OS).
</li>
<li class="listitem">
Reactor-based <code class="computeroutput"><span class="identifier">io_service</span></code>
implementations now use lazy initialisation to reduce the memory usage
of an <code class="computeroutput"><span class="identifier">io_service</span></code> object
used only as a message queue.
</li>
</ul></div>
<h4>
<a name="asio.history.h53"></a>
<span><a name="asio.history.asio_1_2_0"></a></span><a class="link" href="history.html#asio.history.asio_1_2_0">Asio
1.2.0</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
Added support for serial ports.
</li>
<li class="listitem">
Added support for UNIX domain sockets.
</li>
<li class="listitem">
Added support for raw sockets and ICMP.
</li>
<li class="listitem">
Added wrappers for POSIX stream-oriented file descriptors (excluding regular
files).
</li>
<li class="listitem">
Added wrappers for Windows stream-oriented <code class="computeroutput"><span class="identifier">HANDLE</span></code>s
such as named pipes (requires <code class="computeroutput"><span class="identifier">HANDLE</span></code>s
that work with I/O completion ports).
</li>
<li class="listitem">
Added wrappers for Windows random-access <code class="computeroutput"><span class="identifier">HANDLE</span></code>s
such as files (requires <code class="computeroutput"><span class="identifier">HANDLE</span></code>s
that work with I/O completion ports).
</li>
<li class="listitem">
Added support for reactor-style operations (i.e. they report readiness
but perform no I/O) using a new <code class="computeroutput"><span class="identifier">null_buffers</span></code>
type.
</li>
<li class="listitem">
Added an iterator type for bytewise traversal of buffer sequences.
</li>
<li class="listitem">
Added new <code class="computeroutput"><span class="identifier">read_until</span><span class="special">()</span></code>
and <code class="computeroutput"><span class="identifier">async_read_until</span><span class="special">()</span></code>
overloads that take a user-defined function object for locating message
boundaries.
</li>
<li class="listitem">
Added an experimental two-lock queue (enabled by defining <code class="computeroutput"><span class="special">(</span><span class="identifier">BOOST_</span><span class="special">)</span><span class="identifier">ASIO_ENABLE_TWO_LOCK_QUEUE</span></code>)
that may provide better <code class="computeroutput"><span class="identifier">io_service</span></code>
scalability across many processors.
</li>
<li class="listitem">
Various fixes, performance improvements, and more complete coverage of
the custom memory allocation support.
</li>
</ul></div>
<h4>
<a name="asio.history.h54"></a>
<span><a name="asio.history.asio_1_0_0"></a></span><a class="link" href="history.html#asio.history.asio_1_0_0">Asio
1.0.0</a>
</h4>
<p>
First stable release of Asio.
</p>
</div>
<div class="copyright-footer">Copyright © 2003-2023 Christopher M. Kohlhoff<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="std_executors.html"><img src="../prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../home.png" alt="Home"></a><a accesskey="n" href="index.html"><img src="../next.png" alt="Next"></a>
</div>
</body>
</html>