View source code
Display the source code in std/concurrency.d from which this page was generated on
github.
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.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Function std.concurrency.spawnLinked
Starts fn(args) in a logical thread and will receive a LinkTerminated
message when the operation terminates.
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().
Prototype
Tid spawnLinked(F, T...)( F fn, T args ) if (isSpawnable!(F, T));
Parameters
| Name | Description |
|---|---|
| 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