blob: 93d74703281d93c5a8005e8c8dd2e0030daf89bd [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.20"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Qpid Proton C++ API: work_queue</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Qpid Proton C++ API
&#160;<span id="projectnumber">0.32.0</span>
</div>
</td>
<td> <div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.svg"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classproton_1_1work__queue.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classproton_1_1work__queue-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">work_queue</div> </div>
</div><!--header-->
<div class="contents">
<p><b>Unsettled API</b> - A context for thread-safe execution of work.
<a href="classproton_1_1work__queue.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="work__queue_8hpp_source.html">work_queue.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a1e7fdf3236c9477c0462214080c34689"><td class="memItemLeft" align="right" valign="top"><a id="a1e7fdf3236c9477c0462214080c34689"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classproton_1_1work__queue.html#a1e7fdf3236c9477c0462214080c34689">work_queue</a> ()</td></tr>
<tr class="memdesc:a1e7fdf3236c9477c0462214080c34689"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Unsettled API</b> - Create a work queue. <br /></td></tr>
<tr class="separator:a1e7fdf3236c9477c0462214080c34689"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a689e0d941a552db276229a9fc312e143"><td class="memItemLeft" align="right" valign="top"><a id="a689e0d941a552db276229a9fc312e143"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classproton_1_1work__queue.html#a689e0d941a552db276229a9fc312e143">work_queue</a> (<a class="el" href="classproton_1_1container.html">container</a> &amp;)</td></tr>
<tr class="memdesc:a689e0d941a552db276229a9fc312e143"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Unsettled API</b> - Create a work queue backed by a container. <br /></td></tr>
<tr class="separator:a689e0d941a552db276229a9fc312e143"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a59dae2153455bc095477a3b66a0b681e"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classproton_1_1work__queue.html#a59dae2153455bc095477a3b66a0b681e">add</a> (work fn)</td></tr>
<tr class="memdesc:a59dae2153455bc095477a3b66a0b681e"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Unsettled API</b> - Add work <code>fn</code> to the work queue. <a href="classproton_1_1work__queue.html#a59dae2153455bc095477a3b66a0b681e">More...</a><br /></td></tr>
<tr class="separator:a59dae2153455bc095477a3b66a0b681e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7525d36e11cc3eb9d483e8e81713ab6d"><td class="memItemLeft" align="right" valign="top"><a id="a7525d36e11cc3eb9d483e8e81713ab6d"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classproton_1_1work__queue.html#a7525d36e11cc3eb9d483e8e81713ab6d">add</a> (void_function0 &amp;fn)</td></tr>
<tr class="memdesc:a7525d36e11cc3eb9d483e8e81713ab6d"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Deprecated</b> - Use <code><a class="el" href="classproton_1_1work__queue.html#a59dae2153455bc095477a3b66a0b681e" title="Unsettled API - Add work fn to the work queue.">add(work)</a></code>. <br /></td></tr>
<tr class="separator:a7525d36e11cc3eb9d483e8e81713ab6d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a214d82f5924296d6fddbb8b150f8b601"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classproton_1_1work__queue.html#a214d82f5924296d6fddbb8b150f8b601">schedule</a> (<a class="el" href="classproton_1_1duration.html">duration</a>, work fn)</td></tr>
<tr class="memdesc:a214d82f5924296d6fddbb8b150f8b601"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Unsettled API</b> - Add work <code>fn</code> to the work queue after a duration. <a href="classproton_1_1work__queue.html#a214d82f5924296d6fddbb8b150f8b601">More...</a><br /></td></tr>
<tr class="separator:a214d82f5924296d6fddbb8b150f8b601"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aee24365669f2a5d5906866d56c5b2a6e"><td class="memItemLeft" align="right" valign="top"><a id="aee24365669f2a5d5906866d56c5b2a6e"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classproton_1_1work__queue.html#aee24365669f2a5d5906866d56c5b2a6e">schedule</a> (<a class="el" href="classproton_1_1duration.html">duration</a>, void_function0 &amp;fn)</td></tr>
<tr class="memdesc:aee24365669f2a5d5906866d56c5b2a6e"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Deprecated</b> - Use <code><a class="el" href="classproton_1_1work__queue.html#a214d82f5924296d6fddbb8b150f8b601" title="Unsettled API - Add work fn to the work queue after a duration.">schedule(duration, work)</a></code>. <br /></td></tr>
<tr class="separator:aee24365669f2a5d5906866d56c5b2a6e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><b>Unsettled API</b> - A context for thread-safe execution of work. </p>
<p>Event-handler functions associated with a single <code><a class="el" href="classproton_1_1connection.html" title="A connection to a remote AMQP peer.">proton::connection</a></code> are called in sequence. The connection's <code><a class="el" href="classproton_1_1work__queue.html" title="Unsettled API - A context for thread-safe execution of work.">proton::work_queue</a></code> allows you to "inject" extra work from any thread and have it executed in the same sequence.</p>
<p>You may also create arbitrary <code><a class="el" href="classproton_1_1work__queue.html" title="Unsettled API - A context for thread-safe execution of work.">proton::work_queue</a></code> objects backed by a <a class="el" href="classproton_1_1container.html">container</a> that allow other objects to have their own serialised work queues that can have work injected safely from other threads. The <a class="el" href="classproton_1_1container.html">container</a> ensures that the work is correctly serialised.</p>
<p>The <code>proton::work</code> class represents the work to be queued and can be created from a function that takes no parameters and returns no value. </p>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="broker_8cpp-example.html#_a2">broker.cpp</a>, <a class="el" href="multithreaded_client_8cpp-example.html#_a2">multithreaded_client.cpp</a>, <a class="el" href="multithreaded_client_flow_control_8cpp-example.html#_a2">multithreaded_client_flow_control.cpp</a>, <a class="el" href="scheduled_send_8cpp-example.html#_a3">scheduled_send.cpp</a>, and <a class="el" href="scheduled_send_03_8cpp-example.html#_a2">scheduled_send_03.cpp</a>.</dd>
</dl>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a59dae2153455bc095477a3b66a0b681e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a59dae2153455bc095477a3b66a0b681e">&#9670;&nbsp;</a></span>add()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool add </td>
<td>(</td>
<td class="paramtype">work&#160;</td>
<td class="paramname"><em>fn</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p><b>Unsettled API</b> - Add work <code>fn</code> to the work queue. </p>
<p>Work <code>fn</code> will be called serially with other work in the queue. The work may be deferred and executed in another thread.</p>
<dl class="section return"><dt>Returns</dt><dd>true if <code>fn</code> has been or will be called; false if the event loops is ended or <code>fn</code> cannot be injected for any other reason. </dd></dl>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="broker_8cpp-example.html#a5">broker.cpp</a>, <a class="el" href="multithreaded_client_8cpp-example.html#a4">multithreaded_client.cpp</a>, <a class="el" href="multithreaded_client_flow_control_8cpp-example.html#a7">multithreaded_client_flow_control.cpp</a>, and <a class="el" href="scheduled_send_8cpp-example.html#a12">scheduled_send.cpp</a>.</dd>
</dl>
</div>
</div>
<a id="a214d82f5924296d6fddbb8b150f8b601"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a214d82f5924296d6fddbb8b150f8b601">&#9670;&nbsp;</a></span>schedule()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void schedule </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classproton_1_1duration.html">duration</a>&#160;</td>
<td class="paramname">, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">work&#160;</td>
<td class="paramname"><em>fn</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p><b>Unsettled API</b> - Add work <code>fn</code> to the work queue after a duration. </p>
<p>Scheduled execution is "best effort". It may not be possible to inject the work after the elapsed duration. There will be no indication of this.</p>
<p>Work <code>fn</code> will be called serially with other work in the queue. The work may be deferred and executed in another thread.</p>
<dl class="section return"><dt>Returns</dt><dd>true if <code>fn</code> has been or will be called; false if the event loops is ended or <code>fn</code> cannot be injected for any other reason. </dd></dl>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="scheduled_send_03_8cpp-example.html#a10">scheduled_send_03.cpp</a>, and <a class="el" href="service_bus_8cpp-example.html#a27">service_bus.cpp</a>.</dd>
</dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>proton/<a class="el" href="work__queue_8hpp_source.html">work_queue.hpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="namespaceproton.html">proton</a></li><li class="navelem"><a class="el" href="classproton_1_1work__queue.html">work_queue</a></li>
<li class="footer">Generated by <a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.8.20 </li>
</ul>
</div>
</body>
</html>