Idiomatic async programming like C# async/await
Cliff via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Sep 14 09:45:29 PDT 2014
On Sunday, 14 September 2014 at 09:19:11 UTC, Kagamin wrote:
> On Friday, 12 September 2014 at 03:59:58 UTC, Cliff wrote:
>> ...but std.parallelism.Task requires parameterization on the
>> function which the task would execute - that is clearly an
>> implementation detail of the store.
>
> I think, you can wrap the Task in a class.
>
> abstract class CTask
> {
> abstract void wait();
> }
>
> abstract class CTask(TResult)
> {
> abstract TResult result();
> }
>
> class CTTask(TTask): CTask(TResult)
> {
> TTask task; //std.parallelism.Task
> override void wait(){ ... }
> override TResult result(){ ... }
> }
Yep, that's what I figured. Thanks :)
More information about the Digitalmars-d-learn
mailing list