<?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="md__docs_overview" kind="page">
    <compoundname>md_Docs_overview</compoundname>
    <title>Concurrency Kit Overview</title>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
<para>The Concurrency Kit is a .NET/Mono kit that includes a port of the <ulink url="http://msdn.microsoft.com/en-us/library/dd460717.aspx">Task Parallel Library</ulink> and extends it to support <ulink url="http://en.wikipedia.org/wiki/Fiber_(computer_science)">Fibers</ulink>, <ulink url="http://en.wikipedia.org/wiki/Coroutine">Coroutines</ulink>, and <ulink url="http://unity3d.com/">Unity</ulink>. Fibers allow code paths to execute concurrently using a single thread by leveraging the co-operative yielding behavior of coroutines.</para>
<para><programlisting filename=".cs"><codeline><highlight class="comment">//<sp/>Start<sp/>task<sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal">var<sp/>t1<sp/>=<sp/>Task.Factory.StartNew(()<sp/>=&gt;<sp/>PatHead());</highlight></codeline>
<codeline><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal"></highlight><highlight class="comment">//<sp/>Start<sp/>task<sp/>2</highlight><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal">var<sp/>t2<sp/>=<sp/>Task.Factory.StartNew(()<sp/>=&gt;<sp/>RubTummy());</highlight></codeline>
<codeline><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal"></highlight><highlight class="comment">//<sp/>This<sp/>task<sp/>will<sp/>complete<sp/>when<sp/>t1<sp/>and<sp/>t2<sp/>complete<sp/>and</highlight><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal"></highlight><highlight class="comment">//<sp/>then<sp/>it<sp/>will<sp/>continue<sp/>by<sp/>executing<sp/>a<sp/>happy<sp/>dance.</highlight><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal">Task.WhenAll(t1,<sp/>t2).ContinueWith((t3)<sp/>=&gt;<sp/>HappyDance());</highlight></codeline>
</programlisting></para>
<para>Because code written in this manner is designed with concurrency in mind, tasks can run in parallel across multiple threads or as concurrent fibers on a single thread just by changing out the task scheduler. This flexibility makes it easy to write and maintain asynchronous code that scales.</para>
<para><heading level="2">Provided Packages </heading>
</para>
<para>The Concurrency Kit consists of four modular packages.</para>
<para><image type="html" name="packages.png">Packages</image>
<image type="latex" name="packages.png">Packages</image>
<image type="rtf" name="packages.png">Packages</image>
<image type="docbook" name="packages.png">Packages</image>
</para>
<para><heading level="2">Using Asynchronous Tasks </heading>
</para>
<para>When using a .NET runtime earlier than v4, add a reference to the <bold>System.Threading.dll</bold> assembly provided by the Concurrency Kit to add support for <ulink url="http://msdn.microsoft.com/en-us/library/dd537609">Tasks</ulink> and <ulink url="http://msdn.microsoft.com/en-us/library/dd997305.aspx">Thread-Safe Collections</ulink> to your project.</para>
<para>For a full explanation of the Task programming model, please see the <ulink url="http://msdn.microsoft.com/en-us/library/dd460717">Task Parallel Library</ulink> documentation on MSDN.</para>
<para><heading level="2">Using Fibers </heading>
</para>
<para>Fiber support is provided by the <bold>SpicyPixel.Threading.dll</bold> assembly and it includes packages for both the core fiber features as well as an asynchronous task model for fibers.</para>
<para>Please see the <ref refid="md__docs_fibers" kindref="compound">Fibers</ref> and <ref refid="md__docs_fiber-tasks" kindref="compound">Fiber Tasks</ref> topics for more information.</para>
<para><heading level="2">Using Fibers in Unity </heading>
</para>
<para>Unity specific fiber support is provided by the <bold>SpicyPixel.Threading.Unity.dll</bold> assembly and it includes a <ref refid="class_spicy_pixel_1_1_threading_1_1_unity_fiber_scheduler" kindref="compound">UnityFiberScheduler</ref> that can schedule work as a Unity coroutine using either the core fiber model or the task model.</para>
<para>The package also extends MonoBehaviour to support convenience methods for working with fibers and tasks. See <ref refid="md__docs_unity-integration" kindref="compound">Unity Integration</ref>.</para>
<para><heading level="2">Version History </heading>
</para>
<para>Version 1.0.4</para>
<para><itemizedlist>
<listitem><para>Integrate latest Mono version</para>
</listitem><listitem><para>AOT fixes</para>
</listitem><listitem><para>Rename scheduler &apos;SharedInstance&apos; singletons to &apos;Default&apos; for consistency with TPL</para>
</listitem></itemizedlist>
</para>
<para>Version 1.0.3</para>
<para><itemizedlist>
<listitem><para>Support iOS by working around AOT compiler limitations</para>
</listitem><listitem><para>Add the following convenience types and members:<itemizedlist>
<listitem><para>class UnitySynchronizationContext</para>
</listitem><listitem><para>class UnityTaskFactory</para>
</listitem><listitem><para>class UnityTaskScheduler</para>
</listitem><listitem><para>property UnityFiberScheduler.SharedInstance</para>
</listitem><listitem><para>property ConcurrentBehaviour.SharedInstance</para>
</listitem></itemizedlist>
</para>
</listitem><listitem><para>Add Unity sample ConcurrencyKitSample</para>
</listitem></itemizedlist>
</para>
<para>Version 1.0</para>
<para><itemizedlist>
<listitem><para>Initial release </para>
</listitem></itemizedlist>
</para>
    </detaileddescription>
  </compounddef>
</doxygen>
