<?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.6" xml:lang="en-US">
  <compounddef id="classtf_1_1TaskQueue" kind="class" language="C++" prot="public">
    <compoundname>tf::TaskQueue</compoundname>
    <includes refid="tsq_8hpp" local="no">tsq.hpp</includes>
    <innerclass refid="structtf_1_1TaskQueue_1_1Array" prot="private">tf::TaskQueue::Array</innerclass>
    <templateparamlist>
      <param>
        <type>typename T</type>
      </param>
      <param>
        <type>unsigned</type>
        <declname>TF_MAX_PRIORITY</declname>
        <defname>TF_MAX_PRIORITY</defname>
        <defval>static_cast&lt;unsigned&gt;(<ref refid="namespacetf_1ac9f4add8f716ed323b0bdbbc1d89346fa26a4b44a837bf97b972628509912b4a5" kindref="member">TaskPriority::MAX</ref>)</defval>
      </param>
    </templateparamlist>
      <sectiondef kind="private-attrib">
      <memberdef kind="variable" id="classtf_1_1TaskQueue_1a8b8c8e69e04481708b8b17059398a04b" prot="private" static="no" mutable="no">
        <type>CachelineAligned&lt; <ref refid="cpp/atomic/atomic" kindref="compound" external="/Users/twhuang/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::atomic</ref>&lt; int64_t &gt; &gt;</type>
        <definition>CachelineAligned&lt;std::atomic&lt;int64_t&gt; &gt; tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::_top[TF_MAX_PRIORITY]</definition>
        <argsstring>[TF_MAX_PRIORITY]</argsstring>
        <name>_top</name>
        <qualifiedname>tf::TaskQueue::_top</qualifiedname>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="155" column="20" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="155" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="classtf_1_1TaskQueue_1aebf6dd0368728d9fa25127020afb9dda" prot="private" static="no" mutable="no">
        <type>CachelineAligned&lt; <ref refid="cpp/atomic/atomic" kindref="compound" external="/Users/twhuang/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::atomic</ref>&lt; int64_t &gt; &gt;</type>
        <definition>CachelineAligned&lt;std::atomic&lt;int64_t&gt; &gt; tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::_bottom[TF_MAX_PRIORITY]</definition>
        <argsstring>[TF_MAX_PRIORITY]</argsstring>
        <name>_bottom</name>
        <qualifiedname>tf::TaskQueue::_bottom</qualifiedname>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="156" column="20" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="156" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="classtf_1_1TaskQueue_1abaadb3c00494c5873bc7fd5d8ec30f06" prot="private" static="no" mutable="no">
        <type><ref refid="cpp/atomic/atomic" kindref="compound" external="/Users/twhuang/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::atomic</ref>&lt; Array * &gt;</type>
        <definition>std::atomic&lt;Array*&gt; tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::_array[TF_MAX_PRIORITY]</definition>
        <argsstring>[TF_MAX_PRIORITY]</argsstring>
        <name>_array</name>
        <qualifiedname>tf::TaskQueue::_array</qualifiedname>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="157" column="15" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="157" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="classtf_1_1TaskQueue_1aeb6fedf457596dad3f64af57343613cd" prot="private" static="no" mutable="no">
        <type><ref refid="cpp/container/vector" kindref="compound" external="/Users/twhuang/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::vector</ref>&lt; Array * &gt;</type>
        <definition>std::vector&lt;Array*&gt; tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::_garbage[TF_MAX_PRIORITY]</definition>
        <argsstring>[TF_MAX_PRIORITY]</argsstring>
        <name>_garbage</name>
        <qualifiedname>tf::TaskQueue::_garbage</qualifiedname>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="158" column="15" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="158" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="public-func">
      <memberdef kind="function" id="classtf_1_1TaskQueue_1a715574f55d3a05ec4040fc390bfcd632" prot="public" static="no" const="no" explicit="yes" inline="no" virt="non-virtual">
        <type></type>
        <definition>tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::TaskQueue</definition>
        <argsstring>(int64_t capacity=512)</argsstring>
        <name>TaskQueue</name>
        <qualifiedname>tf::TaskQueue::TaskQueue</qualifiedname>
        <param>
          <type>int64_t</type>
          <declname>capacity</declname>
          <defval>512</defval>
        </param>
        <briefdescription>
<para>constructs the queue with a given capacity </para>
        </briefdescription>
        <detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>capacity</parametername>
</parameternamelist>
<parameterdescription>
<para>the capacity of the queue (must be power of 2) </para>
</parameterdescription>
</parameteritem>
</parameterlist>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="169" column="14" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="261" bodyend="269"/>
      </memberdef>
      <memberdef kind="function" id="classtf_1_1TaskQueue_1a15d5b45f482cba7383512a9c5bcbd7cf" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type></type>
        <definition>tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::~TaskQueue</definition>
        <argsstring>()</argsstring>
        <name>~TaskQueue</name>
        <qualifiedname>tf::TaskQueue::~TaskQueue</qualifiedname>
        <briefdescription>
<para>destructs the queue </para>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="174" column="5" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="273" bodyend="280"/>
      </memberdef>
      <memberdef kind="function" id="classtf_1_1TaskQueue_1adfdf70255e24d62c46b31b09c47d78f7" prot="public" static="no" const="yes" explicit="no" inline="no" noexcept="yes" virt="non-virtual">
        <type>bool</type>
        <definition>bool tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::empty</definition>
        <argsstring>() const noexcept</argsstring>
        <name>empty</name>
        <qualifiedname>tf::TaskQueue::empty</qualifiedname>
        <briefdescription>
<para>queries if the queue is empty at the time of this call </para>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="179" column="10" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="284" bodyend="291"/>
      </memberdef>
      <memberdef kind="function" id="classtf_1_1TaskQueue_1af57eb2ebc4d92120d7eaf868ec57b524" prot="public" static="no" const="yes" explicit="no" inline="no" noexcept="yes" virt="non-virtual">
        <type>bool</type>
        <definition>bool tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::empty</definition>
        <argsstring>(unsigned priority) const noexcept</argsstring>
        <name>empty</name>
        <qualifiedname>tf::TaskQueue::empty</qualifiedname>
        <param>
          <type>unsigned</type>
          <declname>priority</declname>
        </param>
        <briefdescription>
<para>queries if the queue is empty at a specific priority value </para>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="184" column="10" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="295" bodyend="299"/>
      </memberdef>
      <memberdef kind="function" id="classtf_1_1TaskQueue_1ad598bef2211bf4cc99d66d80a12ebb6a" prot="public" static="no" const="yes" explicit="no" inline="no" noexcept="yes" virt="non-virtual">
        <type>size_t</type>
        <definition>size_t tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::size</definition>
        <argsstring>() const noexcept</argsstring>
        <name>size</name>
        <qualifiedname>tf::TaskQueue::size</qualifiedname>
        <briefdescription>
<para>queries the number of items at the time of this call </para>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="189" column="12" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="303" bodyend="307"/>
      </memberdef>
      <memberdef kind="function" id="classtf_1_1TaskQueue_1a0386ad90ced931025d14ea955ce40d8c" prot="public" static="no" const="yes" explicit="no" inline="no" noexcept="yes" virt="non-virtual">
        <type>size_t</type>
        <definition>size_t tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::size</definition>
        <argsstring>(unsigned priority) const noexcept</argsstring>
        <name>size</name>
        <qualifiedname>tf::TaskQueue::size</qualifiedname>
        <param>
          <type>unsigned</type>
          <declname>priority</declname>
        </param>
        <briefdescription>
<para>queries the number of items with the given priority at the time of this call </para>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="195" column="12" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="311" bodyend="315"/>
      </memberdef>
      <memberdef kind="function" id="classtf_1_1TaskQueue_1ad47b2671aa5270bcd05605c4063280ff" prot="public" static="no" const="yes" explicit="no" inline="no" noexcept="yes" virt="non-virtual">
        <type>int64_t</type>
        <definition>int64_t tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::capacity</definition>
        <argsstring>() const noexcept</argsstring>
        <name>capacity</name>
        <qualifiedname>tf::TaskQueue::capacity</qualifiedname>
        <briefdescription>
<para>queries the capacity of the queue </para>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="200" column="13" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="413" bodyend="419"/>
      </memberdef>
      <memberdef kind="function" id="classtf_1_1TaskQueue_1ab868d17013212547d750267710037877" prot="public" static="no" const="yes" explicit="no" inline="no" noexcept="yes" virt="non-virtual">
        <type>int64_t</type>
        <definition>int64_t tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::capacity</definition>
        <argsstring>(unsigned priority) const noexcept</argsstring>
        <name>capacity</name>
        <qualifiedname>tf::TaskQueue::capacity</qualifiedname>
        <param>
          <type>unsigned</type>
          <declname>priority</declname>
        </param>
        <briefdescription>
<para>queries the capacity of the queue at a specific priority value </para>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="205" column="13" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="423" bodyend="425"/>
      </memberdef>
      <memberdef kind="function" id="classtf_1_1TaskQueue_1ab90cef7de0b45650b67971db0ccbef76" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>TF_FORCE_INLINE void</type>
        <definition>TF_FORCE_INLINE void tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::push</definition>
        <argsstring>(T item, unsigned priority)</argsstring>
        <name>push</name>
        <qualifiedname>tf::TaskQueue::push</qualifiedname>
        <param>
          <type>T</type>
          <declname>item</declname>
        </param>
        <param>
          <type>unsigned</type>
          <declname>priority</declname>
        </param>
        <briefdescription>
<para>inserts an item to the queue </para>
        </briefdescription>
        <detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>item</parametername>
</parameternamelist>
<parameterdescription>
<para>the item to push to the queue </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>priority</parametername>
</parameternamelist>
<parameterdescription>
<para>priority value of the item to push (default = 0)</para>
</parameterdescription>
</parameteritem>
</parameterlist>
Only the owner thread can insert an item to the queue. The operation can trigger the queue to resize its capacity if more space is required. </para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="217" column="26" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="319" bodyend="333"/>
      </memberdef>
      <memberdef kind="function" id="classtf_1_1TaskQueue_1a3df0b3554e814385d23ee603941391df" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>T</type>
        <definition>T tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::pop</definition>
        <argsstring>()</argsstring>
        <name>pop</name>
        <qualifiedname>tf::TaskQueue::pop</qualifiedname>
        <briefdescription>
<para>pops out an item from the queue </para>
        </briefdescription>
        <detaileddescription>
<para>Only the owner thread can pop out an item from the queue. The return can be a <computeroutput>nullptr</computeroutput> if this operation failed (empty queue). </para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="225" column="7" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="337" bodyend="344"/>
      </memberdef>
      <memberdef kind="function" id="classtf_1_1TaskQueue_1ab486c2b496bc5ebc84122924921e5632" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>TF_FORCE_INLINE T</type>
        <definition>TF_FORCE_INLINE T tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::pop</definition>
        <argsstring>(unsigned priority)</argsstring>
        <name>pop</name>
        <qualifiedname>tf::TaskQueue::pop</qualifiedname>
        <param>
          <type>unsigned</type>
          <declname>priority</declname>
        </param>
        <briefdescription>
<para>pops out an item with a specific priority value from the queue </para>
        </briefdescription>
        <detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>priority</parametername>
</parameternamelist>
<parameterdescription>
<para>priority of the item to pop</para>
</parameterdescription>
</parameteritem>
</parameterlist>
Only the owner thread can pop out an item from the queue. The return can be a <computeroutput>nullptr</computeroutput> if this operation failed (empty queue). </para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="235" column="23" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="348" bodyend="375"/>
      </memberdef>
      <memberdef kind="function" id="classtf_1_1TaskQueue_1a23e13cb9f98316b26c00ce494aa2f0c6" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>T</type>
        <definition>T tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::steal</definition>
        <argsstring>()</argsstring>
        <name>steal</name>
        <qualifiedname>tf::TaskQueue::steal</qualifiedname>
        <briefdescription>
<para>steals an item from the queue </para>
        </briefdescription>
        <detaileddescription>
<para>Any threads can try to steal an item from the queue. The return can be a <computeroutput>nullptr</computeroutput> if this operation failed (not necessary empty). </para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="243" column="7" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="379" bodyend="386"/>
      </memberdef>
      <memberdef kind="function" id="classtf_1_1TaskQueue_1aca896b5d59a78a018aeb313760ca735a" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>T</type>
        <definition>T tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::steal</definition>
        <argsstring>(unsigned priority)</argsstring>
        <name>steal</name>
        <qualifiedname>tf::TaskQueue::steal</qualifiedname>
        <param>
          <type>unsigned</type>
          <declname>priority</declname>
        </param>
        <briefdescription>
<para>steals an item with a specific priority value from the queue </para>
        </briefdescription>
        <detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>priority</parametername>
</parameternamelist>
<parameterdescription>
<para>priority of the item to steal</para>
</parameterdescription>
</parameteritem>
</parameterlist>
Any threads can try to steal an item from the queue. The return can be a <computeroutput>nullptr</computeroutput> if this operation failed (not necessary empty). </para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="253" column="7" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="390" bodyend="409"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="private-func">
      <memberdef kind="function" id="classtf_1_1TaskQueue_1a512796f5396f152af2f8249bc5519596" prot="private" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>TF_NO_INLINE Array *</type>
        <definition>TF_NO_INLINE TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::Array * tf::TaskQueue&lt; T, TF_MAX_PRIORITY &gt;::resize_array</definition>
        <argsstring>(Array *a, unsigned p, std::int64_t b, std::int64_t t)</argsstring>
        <name>resize_array</name>
        <qualifiedname>tf::TaskQueue::resize_array</qualifiedname>
        <param>
          <type>Array *</type>
          <declname>a</declname>
        </param>
        <param>
          <type>unsigned</type>
          <declname>p</declname>
        </param>
        <param>
          <type><ref refid="cpp/types/integer" kindref="compound" external="/Users/twhuang/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::int64_t</ref></type>
          <declname>b</declname>
        </param>
        <param>
          <type><ref refid="cpp/types/integer" kindref="compound" external="/Users/twhuang/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::int64_t</ref></type>
          <declname>t</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="256" column="24" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="429" bodyend="438"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
<para>class to create a lock-free unbounded single-producer multiple-consumer queue </para>
    </briefdescription>
    <detaileddescription>
<para><parameterlist kind="templateparam"><parameteritem>
<parameternamelist>
<parametername>T</parametername>
</parameternamelist>
<parameterdescription>
<para>data type (must be a pointer type) </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>TF_MAX_PRIORITY</parametername>
</parameternamelist>
<parameterdescription>
<para>maximum level of the priority</para>
</parameterdescription>
</parameteritem>
</parameterlist>
</para>
<para>This class implements the work-stealing queue described in the paper, <ulink url="https://www.di.ens.fr/~zappa/readings/ppopp13.pdf">Correct and Efficient Work-Stealing for Weak Memory Models</ulink>, and extends it to include priority.</para>
<para>Only the queue owner can perform pop and push operations, while others can steal data from the queue simultaneously. Priority starts from zero (highest priority) to the template value <computeroutput>TF_MAX_PRIORITY-1</computeroutput> (lowest priority). All operations are associated with priority values to indicate the corresponding queues to which an operation is applied.</para>
<para>The default template value, <computeroutput>TF_MAX_PRIORITY</computeroutput>, is <computeroutput><ref refid="namespacetf_1ac9f4add8f716ed323b0bdbbc1d89346fa26a4b44a837bf97b972628509912b4a5" kindref="member">TaskPriority::MAX</ref></computeroutput> which applies only three priority levels to the task queue.</para>
<para><programlisting filename=".cpp"><codeline><highlight class="keyword">auto</highlight><highlight class="normal"><sp/>[A,<sp/>B,<sp/>C,<sp/>D,<sp/>E]<sp/>=<sp/>taskflow.emplace(</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/>[]<sp/>()<sp/>{<sp/>},</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/>[&amp;]<sp/>()<sp/>{<sp/></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="cpp/io/basic_ostream" kindref="compound" external="/Users/twhuang/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::cout</ref><sp/>&lt;&lt;<sp/></highlight><highlight class="stringliteral">&quot;Task<sp/>B:<sp/>&quot;</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>counter++<sp/>&lt;&lt;<sp/></highlight><highlight class="charliteral">&apos;\n&apos;</highlight><highlight class="normal">;<sp/><sp/></highlight><highlight class="comment">//<sp/>0</highlight><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/>},</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/>[&amp;]<sp/>()<sp/>{<sp/></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="cpp/io/basic_ostream" kindref="compound" external="/Users/twhuang/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::cout</ref><sp/>&lt;&lt;<sp/></highlight><highlight class="stringliteral">&quot;Task<sp/>C:<sp/>&quot;</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>counter++<sp/>&lt;&lt;<sp/></highlight><highlight class="charliteral">&apos;\n&apos;</highlight><highlight class="normal">;<sp/><sp/></highlight><highlight class="comment">//<sp/>2</highlight><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/>},</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/>[&amp;]<sp/>()<sp/>{<sp/></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="cpp/io/basic_ostream" kindref="compound" external="/Users/twhuang/Code/taskflow/doxygen/cppreference-doxygen-web.tag.xml">std::cout</ref><sp/>&lt;&lt;<sp/></highlight><highlight class="stringliteral">&quot;Task<sp/>D:<sp/>&quot;</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>counter++<sp/>&lt;&lt;<sp/></highlight><highlight class="charliteral">&apos;\n&apos;</highlight><highlight class="normal">;<sp/><sp/></highlight><highlight class="comment">//<sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/>},</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/>[]<sp/>()<sp/>{<sp/>}</highlight></codeline>
<codeline><highlight class="normal">);</highlight></codeline>
<codeline><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal">A.precede(B,<sp/>C,<sp/>D);<sp/></highlight></codeline>
<codeline><highlight class="normal">E.succeed(B,<sp/>C,<sp/>D);</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline><highlight class="normal">B.priority(<ref refid="namespacetf_1ac9f4add8f716ed323b0bdbbc1d89346fab89de3b4b81c4facfac906edf29aec8c" kindref="member">tf::TaskPriority::HIGH</ref>);</highlight></codeline>
<codeline><highlight class="normal">C.priority(<ref refid="namespacetf_1ac9f4add8f716ed323b0bdbbc1d89346fa41bc94cbd8eebea13ce0491b2ac11b88" kindref="member">tf::TaskPriority::LOW</ref>);</highlight></codeline>
<codeline><highlight class="normal">D.priority(<ref refid="namespacetf_1ac9f4add8f716ed323b0bdbbc1d89346fa1e23852820b9154316c7c06e2b7ba051" kindref="member">tf::TaskPriority::NORMAL</ref>);</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline><highlight class="normal">executor.run(taskflow).wait();</highlight></codeline>
</programlisting></para>
<para>In the above example, we have a task graph of five tasks, <computeroutput>A</computeroutput>, <computeroutput>B</computeroutput>, <computeroutput>C</computeroutput>, <computeroutput>D</computeroutput>, and <computeroutput>E</computeroutput>, in which <computeroutput>B</computeroutput>, <computeroutput>C</computeroutput>, and <computeroutput>D</computeroutput> can run in simultaneously when <computeroutput>A</computeroutput> finishes. Since we only uses one worker thread in the executor, we can deterministically run <computeroutput>B</computeroutput> first, then <computeroutput>D</computeroutput>, and <computeroutput>C</computeroutput> in order of their priority values. The output is as follows:</para>
<para><programlisting filename=".shell-session"><codeline><highlight class="normal">Task<sp/>B:<sp/>0</highlight></codeline>
<codeline><highlight class="normal">Task<sp/>D:<sp/>1</highlight></codeline>
<codeline><highlight class="normal">Task<sp/>C:<sp/>2</highlight></codeline>
</programlisting> </para>
    </detaileddescription>
    <location file="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" line="110" column="1" bodyfile="/Users/twhuang/Code/taskflow/taskflow/core/tsq.hpp" bodystart="110" bodyend="257"/>
    <listofallmembers>
      <member refid="classtf_1_1TaskQueue_1abaadb3c00494c5873bc7fd5d8ec30f06" prot="private" virt="non-virtual"><scope>tf::TaskQueue</scope><name>_array</name></member>
      <member refid="classtf_1_1TaskQueue_1aebf6dd0368728d9fa25127020afb9dda" prot="private" virt="non-virtual"><scope>tf::TaskQueue</scope><name>_bottom</name></member>
      <member refid="classtf_1_1TaskQueue_1aeb6fedf457596dad3f64af57343613cd" prot="private" virt="non-virtual"><scope>tf::TaskQueue</scope><name>_garbage</name></member>
      <member refid="classtf_1_1TaskQueue_1a8b8c8e69e04481708b8b17059398a04b" prot="private" virt="non-virtual"><scope>tf::TaskQueue</scope><name>_top</name></member>
      <member refid="classtf_1_1TaskQueue_1ad47b2671aa5270bcd05605c4063280ff" prot="public" virt="non-virtual"><scope>tf::TaskQueue</scope><name>capacity</name></member>
      <member refid="classtf_1_1TaskQueue_1ab868d17013212547d750267710037877" prot="public" virt="non-virtual"><scope>tf::TaskQueue</scope><name>capacity</name></member>
      <member refid="classtf_1_1TaskQueue_1adfdf70255e24d62c46b31b09c47d78f7" prot="public" virt="non-virtual"><scope>tf::TaskQueue</scope><name>empty</name></member>
      <member refid="classtf_1_1TaskQueue_1af57eb2ebc4d92120d7eaf868ec57b524" prot="public" virt="non-virtual"><scope>tf::TaskQueue</scope><name>empty</name></member>
      <member refid="classtf_1_1TaskQueue_1a3df0b3554e814385d23ee603941391df" prot="public" virt="non-virtual"><scope>tf::TaskQueue</scope><name>pop</name></member>
      <member refid="classtf_1_1TaskQueue_1ab486c2b496bc5ebc84122924921e5632" prot="public" virt="non-virtual"><scope>tf::TaskQueue</scope><name>pop</name></member>
      <member refid="classtf_1_1TaskQueue_1ab90cef7de0b45650b67971db0ccbef76" prot="public" virt="non-virtual"><scope>tf::TaskQueue</scope><name>push</name></member>
      <member refid="classtf_1_1TaskQueue_1a512796f5396f152af2f8249bc5519596" prot="private" virt="non-virtual"><scope>tf::TaskQueue</scope><name>resize_array</name></member>
      <member refid="classtf_1_1TaskQueue_1ad598bef2211bf4cc99d66d80a12ebb6a" prot="public" virt="non-virtual"><scope>tf::TaskQueue</scope><name>size</name></member>
      <member refid="classtf_1_1TaskQueue_1a0386ad90ced931025d14ea955ce40d8c" prot="public" virt="non-virtual"><scope>tf::TaskQueue</scope><name>size</name></member>
      <member refid="classtf_1_1TaskQueue_1a23e13cb9f98316b26c00ce494aa2f0c6" prot="public" virt="non-virtual"><scope>tf::TaskQueue</scope><name>steal</name></member>
      <member refid="classtf_1_1TaskQueue_1aca896b5d59a78a018aeb313760ca735a" prot="public" virt="non-virtual"><scope>tf::TaskQueue</scope><name>steal</name></member>
      <member refid="classtf_1_1TaskQueue_1a715574f55d3a05ec4040fc390bfcd632" prot="public" virt="non-virtual"><scope>tf::TaskQueue</scope><name>TaskQueue</name></member>
      <member refid="classtf_1_1TaskQueue_1a15d5b45f482cba7383512a9c5bcbd7cf" prot="public" virt="non-virtual"><scope>tf::TaskQueue</scope><name>~TaskQueue</name></member>
    </listofallmembers>
  </compounddef>
</doxygen>
