- Using asio's asynchronous functionality means having a callback
function
- that will be called when an asynchronous operation completes. In
this program
- we define a function called <code class="computeroutput"><span
class="identifier">print</span></code>

- 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_service/run.html"
title="io_service::run">io_service::run()</a>.
- Therefore unless the <a class="link"
href="../reference/io_service/run.html"
title="io_service::run">io_service::run()</a>
- function is called the callback for the asynchronous wait
completion will

- It is important to remember to give the io_service some work to do
before
- calling <a class="link" href="../reference/io_service/run.html"
title="io_service::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_service/run.html"
title="io_service::run">io_service::run()</a> would