Error running concurrent process and storing results in array

data pulverizer data.pulverizer at gmail.com
Wed May 6 07:29:15 UTC 2020


On Wednesday, 6 May 2020 at 06:49:13 UTC, drug wrote:
> ... Then you can pass the arguments in ctor of the derived 
> class like:
> ```
> foreach(long i; 0..n)
>     new DerivedThread(double)(i), cast(double)(i + 1), i, 
> z).start(); thread_joinAll();
> ```
>
> not tested example of derived thread
> ```
> class DerivedThread
> {
>     this(double x, double y, long i, shared(double[]) z)
>     {
>         this.x = x;
> 	this.y = y;
> 	this.i = i;
> 	this.z = z;
>         super(&run);
>     }
> private:
>     void run()
>     {
>          process(x, y, i, z);
>     }
> 	double x, y;
> 	long i;
> 	shared(double[]) z;
> }
> ```

Thanks. Now working.


More information about the Digitalmars-d-learn mailing list