Re: Is this should work?

2016-10-17 Thread Daniel Kozak via Digitalmars-d-learn
Dne 17.10.2016 v 11:56 markov via Digitalmars-d-learn napsal(a): Thanks. So something like this would be helpful in core.thread? void startThread(alias fun, P...)(P p){ new Thread({fun(p);}).start(); } or without delegate import std.stdio; import core.thread; void fun(alias a, alias

Re: Is this should work?

2016-10-17 Thread markov via Digitalmars-d-learn
Thanks. So something like this would be helpful in core.thread? void startThread(alias fun, P...)(P p){ new Thread({fun(p);}).start(); }

Re: Is this should work?

2016-10-16 Thread Ali Çehreli via Digitalmars-d-learn
On 10/16/2016 03:22 PM, markov wrote: void test(string line){ ... }; void main(){ string[] list; foreach (line; list) new Thread({test(line);}).start(); ... } It works in an unexpected way: In D, all those threads would close over the same 'line' loop variable, which happens to