<?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.8.15">
  <compounddef id="_fiber_8_delay_8cs" kind="file" language="C#">
    <compoundname>Fiber.Delay.cs</compoundname>
    <innerclass refid="class_spicy_pixel_1_1_threading_1_1_fiber" prot="public">SpicyPixel::Threading::Fiber</innerclass>
    <innernamespace refid="namespace_spicy_pixel">SpicyPixel</innernamespace>
    <innernamespace refid="namespace_spicy_pixel_1_1_threading">SpicyPixel::Threading</innernamespace>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="keyword">using</highlight><highlight class="normal"><sp/><ref refid="namespace_system" kindref="compound">System</ref>;</highlight></codeline>
<codeline lineno="2"><highlight class="normal"></highlight><highlight class="keyword">using</highlight><highlight class="normal"><sp/><ref refid="namespace_system" kindref="compound">System</ref>.<ref refid="namespace_system_1_1_threading" kindref="compound">Threading</ref>;</highlight></codeline>
<codeline lineno="3"><highlight class="normal"></highlight><highlight class="keyword">using</highlight><highlight class="normal"><sp/><ref refid="namespace_system" kindref="compound">System</ref>.<ref refid="namespace_system_1_1_collections" kindref="compound">Collections</ref>;</highlight></codeline>
<codeline lineno="4"><highlight class="normal"></highlight></codeline>
<codeline lineno="5"><highlight class="normal"></highlight><highlight class="keyword">namespace<sp/></highlight><highlight class="normal"><ref refid="namespace_spicy_pixel_1_1_threading" kindref="compound">SpicyPixel.Threading</ref></highlight></codeline>
<codeline lineno="6"><highlight class="normal">{</highlight></codeline>
<codeline lineno="7"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">partial<sp/>class<sp/></highlight><highlight class="normal">Fiber</highlight></codeline>
<codeline lineno="8"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="13" refid="class_spicy_pixel_1_1_threading_1_1_fiber_1ac283372e16b674401c287c5a945a4de9" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber" kindref="compound">Fiber</ref><sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber_1ac283372e16b674401c287c5a945a4de9" kindref="member">Delay</ref><sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>millisecondsDelay)</highlight></codeline>
<codeline lineno="14"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="15"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber_1ac283372e16b674401c287c5a945a4de9" kindref="member">Delay</ref><sp/>(millisecondsDelay,<sp/><ref refid="struct_system_1_1_threading_1_1_cancellation_token" kindref="compound">CancellationToken</ref>.<ref refid="struct_system_1_1_threading_1_1_cancellation_token_1aa93a5902f076f45412f5e8fbfece237a" kindref="member">None</ref>);</highlight></codeline>
<codeline lineno="16"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="17"><highlight class="normal"></highlight></codeline>
<codeline lineno="22" refid="class_spicy_pixel_1_1_threading_1_1_fiber_1a5c13d4ef930e60a8ffefb1b92a55e87c" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber" kindref="compound">Fiber</ref><sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber_1a5c13d4ef930e60a8ffefb1b92a55e87c" kindref="member">Delay</ref><sp/>(TimeSpan<sp/>delay)</highlight></codeline>
<codeline lineno="23"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="24"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber_1ac283372e16b674401c287c5a945a4de9" kindref="member">Delay</ref><sp/>(CheckTimeout<sp/>(delay),<sp/><ref refid="struct_system_1_1_threading_1_1_cancellation_token" kindref="compound">CancellationToken</ref>.<ref refid="struct_system_1_1_threading_1_1_cancellation_token_1aa93a5902f076f45412f5e8fbfece237a" kindref="member">None</ref>);</highlight></codeline>
<codeline lineno="25"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="26"><highlight class="normal"></highlight></codeline>
<codeline lineno="32" refid="class_spicy_pixel_1_1_threading_1_1_fiber_1ad3c1098fbd5b090ce868ce43527e4501" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber" kindref="compound">Fiber</ref><sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber_1ad3c1098fbd5b090ce868ce43527e4501" kindref="member">Delay</ref><sp/>(TimeSpan<sp/>delay,<sp/><ref refid="struct_system_1_1_threading_1_1_cancellation_token" kindref="compound">CancellationToken</ref><sp/>cancellationToken)</highlight></codeline>
<codeline lineno="33"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="34"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber_1ac283372e16b674401c287c5a945a4de9" kindref="member">Delay</ref><sp/>(CheckTimeout<sp/>(delay),<sp/>cancellationToken);</highlight></codeline>
<codeline lineno="35"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="36"><highlight class="normal"></highlight></codeline>
<codeline lineno="42" refid="class_spicy_pixel_1_1_threading_1_1_fiber_1a10f7c29fdfc0a3cda11aeed44fd95d75" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber" kindref="compound">Fiber</ref><sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber_1a10f7c29fdfc0a3cda11aeed44fd95d75" kindref="member">Delay</ref><sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>millisecondsDelay,<sp/><ref refid="struct_system_1_1_threading_1_1_cancellation_token" kindref="compound">CancellationToken</ref><sp/>cancellationToken)</highlight></codeline>
<codeline lineno="43"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="44"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber_1ac283372e16b674401c287c5a945a4de9" kindref="member">Delay</ref>(millisecondsDelay,<sp/>cancellationToken,<sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber_scheduler" kindref="compound">FiberScheduler</ref>.<ref refid="class_spicy_pixel_1_1_threading_1_1_fiber_scheduler_1ab85bfa23595a91e11fe78d780bb548fb" kindref="member">Current</ref>);</highlight></codeline>
<codeline lineno="45"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="46"><highlight class="normal"></highlight></codeline>
<codeline lineno="53" refid="class_spicy_pixel_1_1_threading_1_1_fiber_1aba6d36d598116f3f87add1a58d729978" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber" kindref="compound">Fiber</ref><sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber_1aba6d36d598116f3f87add1a58d729978" kindref="member">Delay</ref><sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>millisecondsDelay,<sp/><ref refid="struct_system_1_1_threading_1_1_cancellation_token" kindref="compound">CancellationToken</ref><sp/>cancellationToken,<sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber_scheduler" kindref="compound">FiberScheduler</ref><sp/>scheduler)</highlight></codeline>
<codeline lineno="54"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="55"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(millisecondsDelay<sp/>&lt;<sp/>-1)</highlight></codeline>
<codeline lineno="56"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">throw</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">new</highlight><highlight class="normal"><sp/>ArgumentOutOfRangeException<sp/>(</highlight><highlight class="stringliteral">&quot;millisecondsDelay&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="57"><highlight class="normal"></highlight></codeline>
<codeline lineno="58"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="class_spicy_pixel_1_1_threading_1_1_fiber" kindref="compound">Fiber</ref>.<ref refid="class_spicy_pixel_1_1_threading_1_1_fiber_1a2fac263d7ca567ffd0b4b5a9c4b87c89" kindref="member">Factory</ref>.<ref refid="class_spicy_pixel_1_1_threading_1_1_fiber_factory_1a2e0170321f95f5dae367648a3134ed90" kindref="member">StartNew</ref>(DelayCoroutine(millisecondsDelay,<sp/>cancellationToken),<sp/>scheduler);</highlight></codeline>
<codeline lineno="59"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="60"><highlight class="normal"></highlight></codeline>
<codeline lineno="61"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/>IEnumerator<sp/>DelayCoroutine(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>millisecondsDelay,<sp/><ref refid="struct_system_1_1_threading_1_1_cancellation_token" kindref="compound">CancellationToken</ref><sp/>cancellationToken)</highlight></codeline>
<codeline lineno="62"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="63"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>var<sp/>startWait<sp/>=<sp/>DateTime.Now;</highlight></codeline>
<codeline lineno="64"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keyword">true</highlight><highlight class="normal">)<sp/>{</highlight></codeline>
<codeline lineno="65"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Stop<sp/>if<sp/>cancellation<sp/>requested</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="66"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(cancellationToken.<ref refid="struct_system_1_1_threading_1_1_cancellation_token_1a1b0338d63f9b268339e7348629301748" kindref="member">IsCancellationRequested</ref>)<sp/>{</highlight></codeline>
<codeline lineno="67"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>yield<sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="68"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="69"><highlight class="normal"></highlight></codeline>
<codeline lineno="70"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Stop<sp/>if<sp/>delay<sp/>is<sp/>passed</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="71"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(millisecondsDelay<sp/>!=<sp/>Timeout.Infinite<sp/>&amp;&amp;<sp/>(DateTime.Now<sp/>-<sp/>startWait).TotalMilliseconds<sp/>&gt;=<sp/>millisecondsDelay)<sp/>{</highlight></codeline>
<codeline lineno="72"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>yield<sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="73"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="74"><highlight class="normal"></highlight></codeline>
<codeline lineno="75"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>FIXME:<sp/>This<sp/>would<sp/>be<sp/>preferable<sp/>to<sp/>above<sp/>because<sp/>it<sp/>would<sp/>let<sp/>some</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="76"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>schedulers<sp/>sleep.<sp/>It<sp/>requires<sp/>support<sp/>for<sp/>cancellation<sp/>to<sp/>be<sp/>added,<sp/>however.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="77"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//yield<sp/>return<sp/>new<sp/>YieldForSeconds((float)millisecondsDelay<sp/>/<sp/>1000f);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="78"><highlight class="normal"></highlight></codeline>
<codeline lineno="79"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>yield<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>FiberInstruction.YieldToAnyFiber;</highlight></codeline>
<codeline lineno="80"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="81"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="82"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="83"><highlight class="normal">}</highlight></codeline>
<codeline lineno="84"><highlight class="normal"></highlight></codeline>
    </programlisting>
    <location file="Source/SpicyPixel.Threading/Fiber.Delay.cs"/>
  </compounddef>
</doxygen>
