View source code
Display the source code in std/concurrency.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function std.concurrency.spawnLinked

Starts fn(args) in a logical thread and will receive a LinkTerminated message when the operation terminates.

Tid spawnLinked(F, T...) (
  F fn,
  T args
)
if (isSpawnable!(F, T));

Executes the supplied function in a new logical thread represented by Tid. This new thread is linked to the calling thread so that if either it or the calling thread terminates a LinkTerminated message will be sent to the other, causing a LinkTerminated exception to be thrown on receive(). The owner relationship from spawn() is preserved as well, so if the link between threads is broken, owner termination will still result in an OwnerTerminated exception to be thrown on receive().

Parameters

NameDescription
fn The function to execute.
args Arguments to the function.

Returns

A Tid representing the new thread.

Authors

Sean Kelly, Alex Rønne Petersen, Martin Nowak

License

Boost License 1.0.