parallelism with delegate

Imperatorn johan_forsberg_86 at hotmail.com
Fri Sep 22 13:12:30 UTC 2023


On Friday, 22 September 2023 at 04:24:19 UTC, Vitaliy Fadeev 
wrote:
> able ?
> how to use correctly?
>
> ```d
>   import std.parallelism;
>
>   auto async_task = task!fn( args );  // error
>                                       // Error: no property 
> `opCall` for type `app.A`, did you mean `new A`?
>
>   async_task.executeInNewThread();
> ```
>
> where
>
> ```d
> auto a = new A();
> auto fn = &a.download;
>
> class A
> {
>     void fn( string url )
>     {
>         // DO
>     }
> }
> ```
>
> Playground:
> https://run.dlang.io/is/HvhtoP
>
> gist:
> https://gist.github.com/run-dlang/218b69e1afd79e5944ea10aa7ca61e1b

Also check out std.concurrency


More information about the Digitalmars-d-learn mailing list