293 lines
18 KiB
XML
293 lines
18 KiB
XML
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
|
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.9.1" xml:lang="en-US">
|
|
<compounddef id="classtf_1_1AsyncTask" kind="class" language="C++" prot="public">
|
|
<compoundname>tf::AsyncTask</compoundname>
|
|
<includes refid="async__task_8hpp" local="no">taskflow/core/async_task.hpp</includes>
|
|
<sectiondef kind="friend">
|
|
<memberdef kind="friend" id="classtf_1_1AsyncTask_1a763b2f90bc53f92d680a635fe28e858e" prot="private" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
|
|
<type>class</type>
|
|
<definition>friend class Executor</definition>
|
|
<argsstring></argsstring>
|
|
<name>Executor</name>
|
|
<param>
|
|
<type><ref refid="classtf_1_1Executor" kindref="compound">Executor</ref></type>
|
|
</param>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/core/async_task.hpp" line="44" column="3" bodyfile="taskflow/core/async_task.hpp" bodystart="44" bodyend="-1"/>
|
|
</memberdef>
|
|
</sectiondef>
|
|
<sectiondef kind="private-attrib">
|
|
<memberdef kind="variable" id="classtf_1_1AsyncTask_1aa84e10d306fd24a7ecfa8de2cc964cac" prot="private" static="no" mutable="no">
|
|
<type>Node *</type>
|
|
<definition>Node* tf::AsyncTask::_node</definition>
|
|
<argsstring></argsstring>
|
|
<name>_node</name>
|
|
<initializer>{nullptr}</initializer>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/core/async_task.hpp" line="113" column="10" bodyfile="taskflow/core/async_task.hpp" bodystart="113" bodyend="-1"/>
|
|
</memberdef>
|
|
</sectiondef>
|
|
<sectiondef kind="public-func">
|
|
<memberdef kind="function" id="classtf_1_1AsyncTask_1a68689c79c7d794a8be2e1c181c818001" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
|
|
<type></type>
|
|
<definition>tf::AsyncTask::AsyncTask</definition>
|
|
<argsstring>()=default</argsstring>
|
|
<name>AsyncTask</name>
|
|
<briefdescription>
|
|
<para>constructs an empty task handle </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/core/async_task.hpp" line="51" column="5"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1AsyncTask_1a148ddcabda8fd44746b278499cd4cb53" prot="public" static="no" const="no" explicit="no" inline="yes" virt="non-virtual">
|
|
<type></type>
|
|
<definition>tf::AsyncTask::~AsyncTask</definition>
|
|
<argsstring>()</argsstring>
|
|
<name>~AsyncTask</name>
|
|
<briefdescription>
|
|
<para>destroys the managed async task if this is the last owner </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/core/async_task.hpp" line="56" column="5" bodyfile="taskflow/core/async_task.hpp" bodystart="155" bodyend="157"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1AsyncTask_1a682bc679a773da5e45714f71c8137f70" prot="public" static="no" const="no" explicit="no" inline="yes" virt="non-virtual">
|
|
<type></type>
|
|
<definition>tf::AsyncTask::AsyncTask</definition>
|
|
<argsstring>(const AsyncTask &rhs)</argsstring>
|
|
<name>AsyncTask</name>
|
|
<param>
|
|
<type>const <ref refid="classtf_1_1AsyncTask" kindref="compound">AsyncTask</ref> &</type>
|
|
<declname>rhs</declname>
|
|
</param>
|
|
<briefdescription>
|
|
<para>constructs an async task that shares ownership of <computeroutput>rhs</computeroutput> </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/core/async_task.hpp" line="61" column="5" bodyfile="taskflow/core/async_task.hpp" bodystart="143" bodyend="146"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1AsyncTask_1a5a31f85d2ee542f62e784d551ec78896" prot="public" static="no" const="no" explicit="no" inline="yes" virt="non-virtual">
|
|
<type></type>
|
|
<definition>tf::AsyncTask::AsyncTask</definition>
|
|
<argsstring>(AsyncTask &&rhs)</argsstring>
|
|
<name>AsyncTask</name>
|
|
<param>
|
|
<type><ref refid="classtf_1_1AsyncTask" kindref="compound">AsyncTask</ref> &&</type>
|
|
<declname>rhs</declname>
|
|
</param>
|
|
<briefdescription>
|
|
<para>move-constructs an async task from <computeroutput>rhs</computeroutput> </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/core/async_task.hpp" line="66" column="5" bodyfile="taskflow/core/async_task.hpp" bodystart="149" bodyend="152"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1AsyncTask_1a14fa18d27a02c41e01b48ea07e87f5c5" prot="public" static="no" const="no" explicit="no" inline="yes" virt="non-virtual">
|
|
<type><ref refid="classtf_1_1AsyncTask" kindref="compound">AsyncTask</ref> &</type>
|
|
<definition>AsyncTask & tf::AsyncTask::operator=</definition>
|
|
<argsstring>(const AsyncTask &rhs)</argsstring>
|
|
<name>operator=</name>
|
|
<param>
|
|
<type>const <ref refid="classtf_1_1AsyncTask" kindref="compound">AsyncTask</ref> &</type>
|
|
<declname>rhs</declname>
|
|
</param>
|
|
<briefdescription>
|
|
<para>copy-assigns the async task from <computeroutput>rhs</computeroutput> </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
<para>Releases the managed object of <computeroutput>this</computeroutput> and retains a new shared ownership of <computeroutput>rhs</computeroutput>. </para>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/core/async_task.hpp" line="74" column="15" bodyfile="taskflow/core/async_task.hpp" bodystart="160" bodyend="165"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1AsyncTask_1a8dc18d17f3a5d72ef4d9c20ebf7ade4a" prot="public" static="no" const="no" explicit="no" inline="yes" virt="non-virtual">
|
|
<type><ref refid="classtf_1_1AsyncTask" kindref="compound">AsyncTask</ref> &</type>
|
|
<definition>AsyncTask & tf::AsyncTask::operator=</definition>
|
|
<argsstring>(AsyncTask &&rhs)</argsstring>
|
|
<name>operator=</name>
|
|
<param>
|
|
<type><ref refid="classtf_1_1AsyncTask" kindref="compound">AsyncTask</ref> &&</type>
|
|
<declname>rhs</declname>
|
|
</param>
|
|
<briefdescription>
|
|
<para>move-assigns the async task from <computeroutput>rhs</computeroutput> </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
<para>Releases the managed object of <computeroutput>this</computeroutput> and takes over the ownership of <computeroutput>rhs</computeroutput>. </para>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/core/async_task.hpp" line="81" column="15" bodyfile="taskflow/core/async_task.hpp" bodystart="168" bodyend="173"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1AsyncTask_1ae42c70dc0c5edc6d58f47b346125fca3" prot="public" static="no" const="yes" explicit="no" inline="yes" virt="non-virtual">
|
|
<type>bool</type>
|
|
<definition>bool tf::AsyncTask::empty</definition>
|
|
<argsstring>() const</argsstring>
|
|
<name>empty</name>
|
|
<briefdescription>
|
|
<para>checks if this async task is associated with a callable </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/core/async_task.hpp" line="86" column="10" bodyfile="taskflow/core/async_task.hpp" bodystart="176" bodyend="178"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1AsyncTask_1a7c12835577fbdc1bca3190cf92c78088" prot="public" static="no" const="no" explicit="no" inline="yes" virt="non-virtual">
|
|
<type>void</type>
|
|
<definition>void tf::AsyncTask::reset</definition>
|
|
<argsstring>()</argsstring>
|
|
<name>reset</name>
|
|
<briefdescription>
|
|
<para>release the managed object of <computeroutput>this</computeroutput> </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/core/async_task.hpp" line="91" column="10" bodyfile="taskflow/core/async_task.hpp" bodystart="181" bodyend="184"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1AsyncTask_1a826a2ea909094f5a26c2df876de58056" prot="public" static="no" const="yes" explicit="no" inline="yes" virt="non-virtual">
|
|
<type>size_t</type>
|
|
<definition>size_t tf::AsyncTask::hash_value</definition>
|
|
<argsstring>() const</argsstring>
|
|
<name>hash_value</name>
|
|
<briefdescription>
|
|
<para>obtains the hashed value of this async task </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/core/async_task.hpp" line="96" column="12" bodyfile="taskflow/core/async_task.hpp" bodystart="187" bodyend="189"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1AsyncTask_1a6a4a54030f57d1ef05c04ae01825165d" prot="public" static="no" const="yes" explicit="no" inline="yes" virt="non-virtual">
|
|
<type>size_t</type>
|
|
<definition>size_t tf::AsyncTask::use_count</definition>
|
|
<argsstring>() const</argsstring>
|
|
<name>use_count</name>
|
|
<briefdescription>
|
|
<para>returns the number of shared owners that are currently managing this async task </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/core/async_task.hpp" line="102" column="12" bodyfile="taskflow/core/async_task.hpp" bodystart="192" bodyend="197"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1AsyncTask_1aefeefa30d7cafdfbb7dc8def542e8e51" prot="public" static="no" const="yes" explicit="no" inline="yes" virt="non-virtual">
|
|
<type>bool</type>
|
|
<definition>bool tf::AsyncTask::is_done</definition>
|
|
<argsstring>() const</argsstring>
|
|
<name>is_done</name>
|
|
<briefdescription>
|
|
<para>checks if the async task finishes </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/core/async_task.hpp" line="107" column="10" bodyfile="taskflow/core/async_task.hpp" bodystart="200" bodyend="204"/>
|
|
</memberdef>
|
|
</sectiondef>
|
|
<sectiondef kind="private-func">
|
|
<memberdef kind="function" id="classtf_1_1AsyncTask_1ad6a3bcc865f13ecddc1d32306b6df1bb" prot="private" static="no" const="no" explicit="yes" inline="yes" virt="non-virtual">
|
|
<type></type>
|
|
<definition>tf::AsyncTask::AsyncTask</definition>
|
|
<argsstring>(Node *)</argsstring>
|
|
<name>AsyncTask</name>
|
|
<param>
|
|
<type>Node *</type>
|
|
<defname>ptr</defname>
|
|
</param>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/core/async_task.hpp" line="111" column="14" bodyfile="taskflow/core/async_task.hpp" bodystart="120" bodyend="122"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1AsyncTask_1ae2eefe6ee6de4f97dd0b247b053addb1" prot="private" static="no" const="no" explicit="no" inline="yes" virt="non-virtual">
|
|
<type>void</type>
|
|
<definition>void tf::AsyncTask::_incref</definition>
|
|
<argsstring>()</argsstring>
|
|
<name>_incref</name>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/core/async_task.hpp" line="115" column="10" bodyfile="taskflow/core/async_task.hpp" bodystart="125" bodyend="131"/>
|
|
</memberdef>
|
|
<memberdef kind="function" id="classtf_1_1AsyncTask_1aaee1f8ef1109eb90ad20bac2cba4eaca" prot="private" static="no" const="no" explicit="no" inline="yes" virt="non-virtual">
|
|
<type>void</type>
|
|
<definition>void tf::AsyncTask::_decref</definition>
|
|
<argsstring>()</argsstring>
|
|
<name>_decref</name>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<inbodydescription>
|
|
</inbodydescription>
|
|
<location file="taskflow/core/async_task.hpp" line="116" column="10" bodyfile="taskflow/core/async_task.hpp" bodystart="134" bodyend="140"/>
|
|
</memberdef>
|
|
</sectiondef>
|
|
<briefdescription>
|
|
<para>class to create a dependent asynchronous task (async task) </para>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
<para>A <ref refid="classtf_1_1AsyncTask" kindref="compound">tf::AsyncTask</ref> is a lightweight handle that retains <emphasis>shared</emphasis> ownership of a dependent asynchronous task (async task) created by an executor. This shared ownership ensures that the async task remains alive when adding it to the dependency list of another async task, thus avoiding the classical <ulink url="https://en.wikipedia.org/wiki/ABA_problem">ABA problem</ulink>.</para>
|
|
<para><programlisting filename=".cpp"><codeline><highlight class="comment">//<sp/>main<sp/>thread<sp/>retains<sp/>shared<sp/>ownership<sp/>of<sp/>async<sp/>task<sp/>A</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"><ref refid="classtf_1_1AsyncTask" kindref="compound">tf::AsyncTask</ref><sp/>A<sp/>=<sp/>executor.silent_dependent_async([](){});</highlight></codeline>
|
|
<codeline><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"></highlight><highlight class="comment">//<sp/>task<sp/>A<sp/>remains<sp/>alive<sp/>(i.e.,<sp/>at<sp/>least<sp/>one<sp/>ref<sp/>count<sp/>by<sp/>the<sp/>main<sp/>thread)<sp/></highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"></highlight><highlight class="comment">//<sp/>when<sp/>being<sp/>added<sp/>to<sp/>the<sp/>dependency<sp/>list<sp/>of<sp/>async<sp/>task<sp/>B</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline><highlight class="normal"><ref refid="classtf_1_1AsyncTask" kindref="compound">tf::AsyncTask</ref><sp/>B<sp/>=<sp/>executor.silent_dependent_async([](){},<sp/>A);</highlight></codeline>
|
|
</programlisting></para>
|
|
<para>Currently, <ref refid="classtf_1_1AsyncTask" kindref="compound">tf::AsyncTask</ref> is implemented based on the logic of C++ smart pointer <ref refid="cpp/memory/shared_ptr" kindref="compound" external="/home/thuang295/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::shared_ptr</ref> 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. </para>
|
|
</detaileddescription>
|
|
<location file="taskflow/core/async_task.hpp" line="42" column="1" bodyfile="taskflow/core/async_task.hpp" bodystart="42" bodyend="117"/>
|
|
<listofallmembers>
|
|
<member refid="classtf_1_1AsyncTask_1aaee1f8ef1109eb90ad20bac2cba4eaca" prot="private" virt="non-virtual"><scope>tf::AsyncTask</scope><name>_decref</name></member>
|
|
<member refid="classtf_1_1AsyncTask_1ae2eefe6ee6de4f97dd0b247b053addb1" prot="private" virt="non-virtual"><scope>tf::AsyncTask</scope><name>_incref</name></member>
|
|
<member refid="classtf_1_1AsyncTask_1aa84e10d306fd24a7ecfa8de2cc964cac" prot="private" virt="non-virtual"><scope>tf::AsyncTask</scope><name>_node</name></member>
|
|
<member refid="classtf_1_1AsyncTask_1a68689c79c7d794a8be2e1c181c818001" prot="public" virt="non-virtual"><scope>tf::AsyncTask</scope><name>AsyncTask</name></member>
|
|
<member refid="classtf_1_1AsyncTask_1a682bc679a773da5e45714f71c8137f70" prot="public" virt="non-virtual"><scope>tf::AsyncTask</scope><name>AsyncTask</name></member>
|
|
<member refid="classtf_1_1AsyncTask_1a5a31f85d2ee542f62e784d551ec78896" prot="public" virt="non-virtual"><scope>tf::AsyncTask</scope><name>AsyncTask</name></member>
|
|
<member refid="classtf_1_1AsyncTask_1ad6a3bcc865f13ecddc1d32306b6df1bb" prot="private" virt="non-virtual"><scope>tf::AsyncTask</scope><name>AsyncTask</name></member>
|
|
<member refid="classtf_1_1AsyncTask_1ae42c70dc0c5edc6d58f47b346125fca3" prot="public" virt="non-virtual"><scope>tf::AsyncTask</scope><name>empty</name></member>
|
|
<member refid="classtf_1_1AsyncTask_1a763b2f90bc53f92d680a635fe28e858e" prot="private" virt="non-virtual"><scope>tf::AsyncTask</scope><name>Executor</name></member>
|
|
<member refid="classtf_1_1AsyncTask_1a826a2ea909094f5a26c2df876de58056" prot="public" virt="non-virtual"><scope>tf::AsyncTask</scope><name>hash_value</name></member>
|
|
<member refid="classtf_1_1AsyncTask_1aefeefa30d7cafdfbb7dc8def542e8e51" prot="public" virt="non-virtual"><scope>tf::AsyncTask</scope><name>is_done</name></member>
|
|
<member refid="classtf_1_1AsyncTask_1a14fa18d27a02c41e01b48ea07e87f5c5" prot="public" virt="non-virtual"><scope>tf::AsyncTask</scope><name>operator=</name></member>
|
|
<member refid="classtf_1_1AsyncTask_1a8dc18d17f3a5d72ef4d9c20ebf7ade4a" prot="public" virt="non-virtual"><scope>tf::AsyncTask</scope><name>operator=</name></member>
|
|
<member refid="classtf_1_1AsyncTask_1a7c12835577fbdc1bca3190cf92c78088" prot="public" virt="non-virtual"><scope>tf::AsyncTask</scope><name>reset</name></member>
|
|
<member refid="classtf_1_1AsyncTask_1a6a4a54030f57d1ef05c04ae01825165d" prot="public" virt="non-virtual"><scope>tf::AsyncTask</scope><name>use_count</name></member>
|
|
<member refid="classtf_1_1AsyncTask_1a148ddcabda8fd44746b278499cd4cb53" prot="public" virt="non-virtual"><scope>tf::AsyncTask</scope><name>~AsyncTask</name></member>
|
|
</listofallmembers>
|
|
</compounddef>
|
|
</doxygen>
|