summaryrefslogtreecommitdiff
path: root/doc/html/boost_asio/tutorial/tuttimer2.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/html/boost_asio/tutorial/tuttimer2.html')
-rw-r--r--doc/html/boost_asio/tutorial/tuttimer2.html25
1 files changed, 12 insertions, 13 deletions
diff --git a/doc/html/boost_asio/tutorial/tuttimer2.html b/doc/html/boost_asio/tutorial/tuttimer2.html
index 6dbb1d6782..c3e02b4710 100644
--- a/doc/html/boost_asio/tutorial/tuttimer2.html
+++ b/doc/html/boost_asio/tutorial/tuttimer2.html
@@ -34,7 +34,6 @@
</p>
<pre class="programlisting">#include &lt;iostream&gt;
#include &lt;boost/asio.hpp&gt;
-#include &lt;boost/date_time/posix_time/posix_time.hpp&gt;
</pre>
<p>
Using asio's asynchronous functionality means having a callback function
@@ -51,39 +50,39 @@ int main()
{
boost::asio::io_context io;
- boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
+ boost::asio::steady_timer t(io, boost::asio::chrono::seconds(5));
</pre>
<p>
Next, instead of doing a blocking wait as in tutorial Timer.1, we call the
- <a class="link" href="../reference/basic_deadline_timer/async_wait.html" title="basic_deadline_timer::async_wait">deadline_timer::async_wait()</a>
+ <a class="link" href="../reference/basic_waitable_timer/async_wait.html" title="basic_waitable_timer::async_wait">steady_timer::async_wait()</a>
function to perform an asynchronous wait. When calling this function we pass
the <code class="computeroutput">print</code> callback handler that was defined above.
</p>
<pre class="programlisting"> t.async_wait(&amp;print);
</pre>
<p>
- Finally, we must call the <a class="link" href="../reference/io_context/run.html" title="io_context::run">io_service::run()</a>
- member function on the io_service object.
+ Finally, we must call the <a class="link" href="../reference/io_context/run.html" title="io_context::run">io_context::run()</a>
+ member function on the io_context object.
</p>
<p>
The asio library provides a guarantee that callback handlers will only be
- called from threads that are currently calling <a class="link" href="../reference/io_context/run.html" title="io_context::run">io_service::run()</a>.
- Therefore unless the <a class="link" href="../reference/io_context/run.html" title="io_context::run">io_service::run()</a>
+ called from threads that are currently calling <a class="link" href="../reference/io_context/run.html" title="io_context::run">io_context::run()</a>.
+ Therefore unless the <a class="link" href="../reference/io_context/run.html" title="io_context::run">io_context::run()</a>
function is called the callback for the asynchronous wait completion will
never be invoked.
</p>
<p>
- The <a class="link" href="../reference/io_context/run.html" title="io_context::run">io_service::run()</a>
+ The <a class="link" href="../reference/io_context/run.html" title="io_context::run">io_context::run()</a>
function will also continue to run while there is still "work"
to do. In this example, the work is the asynchronous wait on the timer, so
the call will not return until the timer has expired and the callback has
completed.
</p>
<p>
- It is important to remember to give the io_service some work to do before
- calling <a class="link" href="../reference/io_context/run.html" title="io_context::run">io_service::run()</a>.
- For example, if we had omitted the above call to <a class="link" href="../reference/basic_deadline_timer/async_wait.html" title="basic_deadline_timer::async_wait">deadline_timer::async_wait()</a>,
- the io_service would not have had any work to do, and consequently <a class="link" href="../reference/io_context/run.html" title="io_context::run">io_service::run()</a> would
+ It is important to remember to give the io_context some work to do before
+ calling <a class="link" href="../reference/io_context/run.html" title="io_context::run">io_context::run()</a>.
+ For example, if we had omitted the above call to <a class="link" href="../reference/basic_waitable_timer/async_wait.html" title="basic_waitable_timer::async_wait">steady_timer::async_wait()</a>,
+ the io_context would not have had any work to do, and consequently <a class="link" href="../reference/io_context/run.html" title="io_context::run">io_context::run()</a> would
have returned immediately.
</p>
<pre class="programlisting"> io.run();
@@ -108,7 +107,7 @@ int main()
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2003-2017 Christopher M. Kohlhoff<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2003-2018 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>