www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - parallelism with delegate

reply Vitaliy Fadeev <vital.fadeev gmail.com> writes:
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
Sep 21 2023
next sibling parent reply Vitaliy Fadeev <vital.fadeev gmail.com> writes:
On Friday, 22 September 2023 at 04:24:19 UTC, Vitaliy Fadeev 
wrote:
 ...
Skip this thread. I see solution. How to delete missed posts on this forum ?
Sep 21 2023
next sibling parent user1234 <user1234 12.de> writes:
On Friday, 22 September 2023 at 04:33:44 UTC, Vitaliy Fadeev 
wrote:
 On Friday, 22 September 2023 at 04:24:19 UTC, Vitaliy Fadeev 
 wrote:
 ...
Skip this thread. I see solution. How to delete missed posts on this forum ?
It's there forever, you have to live with that error ;) See https://forum.dlang.org/help#about
Sep 21 2023
prev sibling parent Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
On Thursday, September 21, 2023 10:33:44 PM MDT Vitaliy Fadeev via 
Digitalmars-d-learn wrote:
 On Friday, 22 September 2023 at 04:24:19 UTC, Vitaliy Fadeev

 wrote:
 ...
Skip this thread. I see solution. How to delete missed posts on this forum ?
This forum is esentially just a web client for some D-specific newsgroups (and a number of folks access it via either the newsgroup interface or its associated mailing list rather than through the web interface). So, you can't edit or remove posts. Admins can remove spam from the newsgroup (and thus the forum), but that's pretty much it, and even then, that doesn't remove it from the mailing list, because you can't get an e-mail back once it's been sent. So, once you send something to the forum, it's out there forever. - Jonathan M Davis
Sep 21 2023
prev sibling parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
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
Sep 22 2023