Passing arguments to a new thread

Timon Gehr timon.gehr at
Fri Jan 20 07:33:33 PST 2012

On 01/20/2012 03:12 PM, Mars wrote:
> Hello everybody.
> As the title states, I want to run a function in a new thread, and pass
> it some arguments. How would I do that? I guess I could make a class,
> deriving from Thread, and work with it, but out of curiosity, I'd like
> to know if it's possible with a simple function.
> Mars

See std.concurrency.

auto tid = spawn(&function, arg1, arg2, arg3, ...);

More information about the Digitalmars-d-learn mailing list