foreach (i ; 0..4) { auto th = new Thread(delegate(){listRun(i);});//this is erro _thread[i]= th; th.start(); }
void listRun(int i) {writeln("i = ", i); // the value is not(0,1,2,3), it all is 2.
} I want to know how to use it like std::bind.
Dsby via Digitalmars-d-learn Fri, 18 Mar 2016 22:18:30 -0700
foreach (i ; 0..4) { auto th = new Thread(delegate(){listRun(i);});//this is erro _thread[i]= th; th.start(); }
void listRun(int i) {writeln("i = ", i); // the value is not(0,1,2,3), it all is 2.
} I want to know how to use it like std::bind.