Let's say you have an existing synchronous API function:

// Example 1: Original synchronous API // that could take a long time to execute // (to compute, to wait for disk/web, etc.) // RetType DoSomething( InParameters ins, OutParameters outs );

Because DoSomething could take a long time to execute (whether it keeps a CPU core busy or not), and might be independent of other work the caller is doing, naturally the caller might want to execute DoSomething asynchronously. For example, consider calling code like this:

// Example 1, continued: // Sample calling code // void CallerMethod() { // … result = DoSomething( this, that, outTheOther ); // These could also take a long time OtherWork(); MoreOtherWork(); // … now use result and outOther … }

If OtherWork and MoreOtherWork don't depend on the value of result or other side effects of DoSomething , and if they can correctly run concurrently with DoSomething because they don't conflict by using the same data or resources, then it could be useful to execute DoSomething concurrently with OtherWork/MoreOtherWork .

The question is, how should we enable that? There is a simple and correct answer, but because many interfaces have opted for a more complex answer let's consider that one first.