need `this` on trying to use class method with parallelism Task! or task!

Andrey Zherikov andrey.zherikov at gmail.com
Sun Nov 14 16:40:58 UTC 2021


On Sunday, 14 November 2021 at 14:41:21 UTC, Alexey wrote:
> On Sunday, 14 November 2021 at 14:24:00 UTC, Andrey Zherikov 
> wrote:
>> On Sunday, 14 November 2021 at 12:01:36 UTC, Alexey wrote:
>>> 
>>
>> You just need two changes:
>> - make `threadFunc` function static: `static void threadFunc()`
>> - use `task` instead of `Task`: `auto t1 = task!threadFunc;`
>
> I need `this` to be available inside of threadFunc


Just do `auto t1 = task(&threadFunc)` in `threadCreator` then.


More information about the Digitalmars-d-learn mailing list