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;
}

Reply via email to