On 03/01/2013 06:51 PM, Sparsh Mittal wrote: > Possibility 1: Here, I wanted to pass a value by reference to myFunc, > but when I read that value in main function, its value is not changed at > all?
This is a known issue and is documented in the std.parallelism module: http://dlang.org/phobos/std_parallelism.html#.Task "BUGS: Changes to ref and out arguments are not propagated to the call site, only to args in this struct." You can pass a pointer: void myFunc(long *countvar) { *countvar = 500; writeln( " value of countvar is ", *countvar); } // ... tasks[0] = task!myFunc(&count1); Ali
