Async P/Invoke calls
<p>I'm working on a wrapping library for a robot controller, that mostly relies on P/Invoke calls.</p>

<p>However, a lot of the functionality for the robot, such as homing, or movement, takes quite a while, and do thread locks while running.</p>

<p>So I'm wondering how I can wrap the functionality in a async manner, so the calls don't block my UI thread. My idea so far is to use Tasks, but I'm not really sure it's the right approach.</p>

<pre><code>public Task&lt;bool&gt; HomeAsync(Axis axis, CancellationToken token)
{
    return Task.Factory.StartNew(() =&gt; Home(axis), token);
}
</code></pre>

<p>Most of the MSDN articles on the Async model in .NET as of right now, mostly is relaying on libraries already having Async functionality (such as File.BeginRead and so on). But I can't seem to find much information on how to actually write the async functionality in the first place.</p>
