View on GitHub

DSFML

dsfml.system.thread

A module containing the DSFML Thread class

class Thread;
Utility class to manipulate threads.

Threads provide a way to run multiple parts of the code in parallel.

When you launch a new thread, the execution is split and both the new thread and the caller run in parallel.

To use a Thread, you construct it directly with the function to execute as the entry point of the thread.

this(void function() fn, size_t sz = 0);
Construct the thread from a functor with no argument

Params:
void function() fn The function to use as the entry point of the thread.
size_t sz The size of the stack.

this(void delegate() dg, size_t sz = 0);
Construct the thread from a delegate with no argument

Params:
void delegate() dg The delegate to use as the entry point of the thread.
size_t sz The size of the stack.

void launch();
Run the thread.

void wait();
Wait until the thread finishes.