Is this should work?
Daniel Kozak via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Oct 17 03:08:12 PDT 2016
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 msg)()
{
writefln("Hello number %d from %s", a, msg);
}
void main()
{
int a = 7;
string msg = "main";
auto thr = new Thread(&fun!(a, msg)).start;
thr.join;
}
More information about the Digitalmars-d-learn
mailing list