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

2021-11-14 Thread Andrey Zherikov via Digitalmars-d-learn
On Sunday, 14 November 2021 at 16:55:24 UTC, Alexey wrote: Remove "!"

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

2021-11-14 Thread Alexey via Digitalmars-d-learn
On Sunday, 14 November 2021 at 17:42:18 UTC, Imperatorn wrote: Try task(&threadFunc) instead of task!(&threadFunc) worked! huge thanks!

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

2021-11-14 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 14 November 2021 at 16:55:24 UTC, Alexey wrote: On Sunday, 14 November 2021 at 16:40:58 UTC, Andrey Zherikov wrote: Just do `auto t1 = task(&threadFunc)` in `threadCreator` then. Error: value of `this` is not known at compile time ```D import std.stdio; import std.parallelism; cl

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

2021-11-14 Thread Alexey via Digitalmars-d-learn
On Sunday, 14 November 2021 at 16:40:58 UTC, Andrey Zherikov wrote: Just do `auto t1 = task(&threadFunc)` in `threadCreator` then. Error: value of `this` is not known at compile time ```D import std.stdio; import std.parallelism; class TC { void threadFunc() { import core.thr

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

2021-11-14 Thread Andrey Zherikov via Digitalmars-d-learn
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` in

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

2021-11-14 Thread Alexey via Digitalmars-d-learn
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

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

2021-11-14 Thread Andrey Zherikov via Digitalmars-d-learn
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;`

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

2021-11-14 Thread Alexey via Digitalmars-d-learn
On Sunday, 14 November 2021 at 12:01:36 UTC, Alexey wrote: /home/animuspexus/dlang/d_v2.098.0/dmd/generated/linux/release/64/../../../../../phobos/std/parallelism.d(436): Error: need `this` for `threadFunc` of type `void()` Go example for contrast. Ideally, I'd like something similar; ```Go p

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

2021-11-14 Thread Alexey via Digitalmars-d-learn
On Sunday, 14 November 2021 at 12:01:36 UTC, Alexey wrote: auto t1 = Task!threadFunc; if this line rewritten as `auto t1 = Task!(TC.threadFunc, this);` ```text /home/animuspexus/dlang/d_v2.098.0/dmd/generated/linux/release/64/../../../../../phobos/std/parallelism.d(451): Error

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

2021-11-14 Thread Alexey via Digitalmars-d-learn
/home/animuspexus/dlang/d_v2.098.0/dmd/generated/linux/release/64/../../../../../phobos/std/parallelism.d(436): Error: need `this` for `threadFunc` of type `void()` ./t.d(22): Error: template instance `std.parallelism.Task!(threadFunc)` error instantiating thou documentation says `a function