Idiomatic async programming like C# async/await

Kagamin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Sep 14 02:19:10 PDT 2014


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(){ ... }
}


More information about the Digitalmars-d-learn mailing list