1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>io_context::work</title> 5<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../boost_asio.html" title="Boost.Asio"> 8<link rel="up" href="../reference.html" title="Reference"> 9<link rel="prev" href="io_context__strand/_strand.html" title="io_context::strand::~strand"> 10<link rel="next" href="io_context__work/get_io_context.html" title="io_context::work::get_io_context"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> 15<td align="center"><a href="../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="io_context__strand/_strand.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="io_context__work/get_io_context.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h3 class="title"> 27<a name="boost_asio.reference.io_context__work"></a><a class="link" href="io_context__work.html" title="io_context::work">io_context::work</a> 28</h3></div></div></div> 29<p> 30 (Deprecated: Use <a class="link" href="executor_work_guard.html" title="executor_work_guard"><code class="computeroutput">executor_work_guard</code></a>.) 31 Class to inform the <a class="link" href="io_context.html" title="io_context"><code class="computeroutput">io_context</code></a> 32 when it has work to do. 33 </p> 34<pre class="programlisting">class work 35</pre> 36<h5> 37<a name="boost_asio.reference.io_context__work.h0"></a> 38 <span class="phrase"><a name="boost_asio.reference.io_context__work.member_functions"></a></span><a class="link" href="io_context__work.html#boost_asio.reference.io_context__work.member_functions">Member Functions</a> 39 </h5> 40<div class="informaltable"><table class="table"> 41<colgroup> 42<col> 43<col> 44</colgroup> 45<thead><tr> 46<th> 47 <p> 48 Name 49 </p> 50 </th> 51<th> 52 <p> 53 Description 54 </p> 55 </th> 56</tr></thead> 57<tbody> 58<tr> 59<td> 60 <p> 61 <a class="link" href="io_context__work/get_io_context.html" title="io_context::work::get_io_context"><span class="bold"><strong>get_io_context</strong></span></a> 62 </p> 63 </td> 64<td> 65 <p> 66 Get the io_context associated with the work. 67 </p> 68 </td> 69</tr> 70<tr> 71<td> 72 <p> 73 <a class="link" href="io_context__work/work.html" title="io_context::work::work"><span class="bold"><strong>work</strong></span></a> <span class="silver">[constructor]</span> 74 </p> 75 </td> 76<td> 77 <p> 78 Constructor notifies the io_context that work is starting. <br> 79 <span class="silver"> —</span><br> Copy constructor notifies the io_context that work is starting. 80 </p> 81 </td> 82</tr> 83<tr> 84<td> 85 <p> 86 <a class="link" href="io_context__work/_work.html" title="io_context::work::~work"><span class="bold"><strong>~work</strong></span></a> <span class="silver">[destructor]</span> 87 </p> 88 </td> 89<td> 90 <p> 91 Destructor notifies the io_context that the work is complete. 92 </p> 93 </td> 94</tr> 95</tbody> 96</table></div> 97<p> 98 The work class is used to inform the <a class="link" href="io_context.html" title="io_context"><code class="computeroutput">io_context</code></a> 99 when work starts and finishes. This ensures that the <a class="link" href="io_context.html" title="io_context"><code class="computeroutput">io_context</code></a> 100 object's <code class="computeroutput">run()</code> function will not exit while work is underway, 101 and that it does exit when there is no unfinished work remaining. 102 </p> 103<p> 104 The work class is copy-constructible so that it may be used as a data member 105 in a handler class. It is not assignable. 106 </p> 107<h5> 108<a name="boost_asio.reference.io_context__work.h1"></a> 109 <span class="phrase"><a name="boost_asio.reference.io_context__work.requirements"></a></span><a class="link" href="io_context__work.html#boost_asio.reference.io_context__work.requirements">Requirements</a> 110 </h5> 111<p> 112 <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/io_context.hpp</code> 113 </p> 114<p> 115 <span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio.hpp</code> 116 </p> 117</div> 118<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 119<td align="left"></td> 120<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M. 121 Kohlhoff<p> 122 Distributed under the Boost Software License, Version 1.0. (See accompanying 123 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>) 124 </p> 125</div></td> 126</tr></table> 127<hr> 128<div class="spirit-nav"> 129<a accesskey="p" href="io_context__strand/_strand.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="io_context__work/get_io_context.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 130</div> 131</body> 132</html> 133