<trclass="memdesc:a148ddcabda8fd44746b278499cd4cb53"><tdclass="mdescLeft"> </td><tdclass="mdescRight">destroys the managed dependent-async task if this is the last owner <br/></td></tr>
<trclass="memdesc:a682bc679a773da5e45714f71c8137f70"><tdclass="mdescLeft"> </td><tdclass="mdescRight">constructs a dependent-async task that shares ownership of <code>rhs</code><br/></td></tr>
<trclass="memdesc:a5a31f85d2ee542f62e784d551ec78896"><tdclass="mdescLeft"> </td><tdclass="mdescRight">move-constructs an dependent-async task from <code>rhs</code><br/></td></tr>
<trclass="memdesc:a14fa18d27a02c41e01b48ea07e87f5c5"><tdclass="mdescLeft"> </td><tdclass="mdescRight">copy-assigns the dependent-async task from <code>rhs</code><br/></td></tr>
<trclass="memdesc:a8dc18d17f3a5d72ef4d9c20ebf7ade4a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">move-assigns the dependent-async task from <code>rhs</code><br/></td></tr>
<trclass="memdesc:ae42c70dc0c5edc6d58f47b346125fca3"><tdclass="mdescLeft"> </td><tdclass="mdescRight">checks if this dependent-async task is associated with any task <br/></td></tr>
<trclass="memdesc:a7c12835577fbdc1bca3190cf92c78088"><tdclass="mdescLeft"> </td><tdclass="mdescRight">release the managed object of <code>this</code><br/></td></tr>
<trclass="memdesc:a826a2ea909094f5a26c2df876de58056"><tdclass="mdescLeft"> </td><tdclass="mdescRight">obtains the hashed value of this dependent-async task <br/></td></tr>
<trclass="memdesc:a6a4a54030f57d1ef05c04ae01825165d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">returns the number of shared owners that are currently managing this dependent-async task <br/></td></tr>
<trclass="memdesc:aefeefa30d7cafdfbb7dc8def542e8e51"><tdclass="mdescLeft"> </td><tdclass="mdescRight">checks if this dependent-async task finishes <br/></td></tr>
<trclass="memdesc:aace6e20ee4cb6f82812cf498d0d9828f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">retrieves the exception pointer of this task <br/></td></tr>
<trclass="memdesc:a7f72d09a1cfc7a3a4e5377b7906fec76"><tdclass="mdescLeft"> </td><tdclass="mdescRight">queries if the task has an exception pointer <br/></td></tr>
<divclass="textblock"><p>class to hold a dependent asynchronous task with shared ownership </p>
<p>A <aclass="el" href="classtf_1_1AsyncTask.html" title="class to hold a dependent asynchronous task with shared ownership">tf::AsyncTask</a> is a lightweight handle that retains <em>shared</em> ownership of a dependent asynchronous (dependent-async) task created by an executor. This shared ownership ensures that the dependent-async task remains alive when adding it to the dependency list of another dependent-async task, thus avoiding the classical <ahref="https://en.wikipedia.org/wiki/ABA_problem">ABA problem</a>.</p>
<divclass="fragment"><divclass="line"><spanclass="comment">// main thread retains shared ownership of async task A</span></div>
<divclass="line"><aclass="code hl_class" href="classtf_1_1AsyncTask.html">tf::AsyncTask</a> A = executor.silent_dependent_async([](){});</div>
<divclass="line"></div>
<divclass="line"><spanclass="comment">// task A remains alive (i.e., at least one ref count by the main thread) </span></div>
<divclass="line"><spanclass="comment">// when being added to the dependency list of async task B</span></div>
<divclass="line"><aclass="code hl_class" href="classtf_1_1AsyncTask.html">tf::AsyncTask</a> B = executor.silent_dependent_async([](){}, A);</div>
<divclass="ttc" id="aclasstf_1_1AsyncTask_html"><divclass="ttname"><ahref="classtf_1_1AsyncTask.html">tf::AsyncTask</a></div><divclass="ttdoc">class to hold a dependent asynchronous task with shared ownership</div><divclass="ttdef"><b>Definition</b> async_task.hpp:45</div></div>
</div><!-- fragment --><p><aclass="el" href="classtf_1_1AsyncTask.html" title="class to hold a dependent asynchronous task with shared ownership">tf::AsyncTask</a> is implemented based on the logic of C++ smart pointer std::shared_ptr and is considered cheap to copy or move as long as only a handful of objects own it. When a worker completes an async task, it will remove the task from the executor, decrementing the number of shared owners by one. If that counter reaches zero, the task is destroyed.</p>
<dlclass="section note"><dt>Note</dt><dd>To know more about dependent-async task, please refer to <aclass="el" href="DependentAsyncTasking.html">Asynchronous Tasking with Dependencies</a>. </dd></dl>
</div><h2class="groupheader">Member Function Documentation</h2>
<divclass="ttc" id="aclasstf_1_1AsyncTask_html_ae42c70dc0c5edc6d58f47b346125fca3"><divclass="ttname"><ahref="#ae42c70dc0c5edc6d58f47b346125fca3">tf::AsyncTask::empty</a></div><divclass="ttdeci">bool empty() const</div><divclass="ttdoc">checks if this dependent-async task is associated with any task</div><divclass="ttdef"><b>Definition</b> async_task.hpp:268</div></div>
<p>retrieves the exception pointer of this task </p>
<p>This method retrieves the exception pointer of the task, if any, that was silently caught by the executor. For example, the code below retrieves the exception pointer of a dependent-async task that does not have a shared state to propagate its exception.</p>
<divclass="ttc" id="aclasstf_1_1AsyncTask_html_aace6e20ee4cb6f82812cf498d0d9828f"><divclass="ttname"><ahref="#aace6e20ee4cb6f82812cf498d0d9828f">tf::AsyncTask::exception_ptr</a></div><divclass="ttdeci">std::exception_ptr exception_ptr() const</div><divclass="ttdoc">retrieves the exception pointer of this task</div><divclass="ttdef"><b>Definition</b> async_task.hpp:258</div></div>
<divclass="ttc" id="aclasstf_1_1AsyncTask_html_a826a2ea909094f5a26c2df876de58056"><divclass="ttname"><ahref="#a826a2ea909094f5a26c2df876de58056">tf::AsyncTask::hash_value</a></div><divclass="ttdeci">size_t hash_value() const</div><divclass="ttdoc">obtains the hashed value of this dependent-async task</div><divclass="ttdef"><b>Definition</b> async_task.hpp:279</div></div>
<p>checks if this dependent-async task finishes </p>
<p>In a multithreaded environment, <code>is_done</code> atomically retrieves (with <code>memory_order_acquire</code> load) the underlying state bit that indicates the completion of this dependent-async task. If the dependent-async task is empty, returns <code>true</code>.</p>
<divclass="ttc" id="aclasstf_1_1AsyncTask_html_a7c12835577fbdc1bca3190cf92c78088"><divclass="ttname"><ahref="#a7c12835577fbdc1bca3190cf92c78088">tf::AsyncTask::reset</a></div><divclass="ttdeci">void reset()</div><divclass="ttdoc">release the managed object of this</div><divclass="ttdef"><b>Definition</b> async_task.hpp:273</div></div>
<divclass="ttc" id="aclasstf_1_1AsyncTask_html_aefeefa30d7cafdfbb7dc8def542e8e51"><divclass="ttname"><ahref="#aefeefa30d7cafdfbb7dc8def542e8e51">tf::AsyncTask::is_done</a></div><divclass="ttdeci">bool is_done() const</div><divclass="ttdoc">checks if this dependent-async task finishes</div><divclass="ttdef"><b>Definition</b> async_task.hpp:292</div></div>
<p>returns the number of shared owners that are currently managing this dependent-async task </p>
<p>In a multithreaded environment, <code>use_count</code> atomically retrieves (with <code>memory_order_relaxed</code> load) the number of <aclass="el" href="classtf_1_1AsyncTask.html" title="class to hold a dependent asynchronous task with shared ownership">tf::AsyncTask</a> instances that manage the current task.</p>
<divclass="ttc" id="aclasstf_1_1AsyncTask_html_a6a4a54030f57d1ef05c04ae01825165d"><divclass="ttname"><ahref="#a6a4a54030f57d1ef05c04ae01825165d">tf::AsyncTask::use_count</a></div><divclass="ttdeci">size_t use_count() const</div><divclass="ttdoc">returns the number of shared owners that are currently managing this dependent-async task</div><divclass="ttdef"><b>Definition</b> async_task.hpp:284</div></div>
</div><!-- fragment -->
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>