Kernel.spawn_link

You're seeing just the function spawn_link, go back to Kernel module for more information.

Specs

spawn_link((() -> any())) :: pid()

Spawns the given function, links it to the current process, and returns its PID.

Typically developers do not use the spawn functions, instead they use abstractions such as Task, GenServer and Agent, built on top of spawn, that spawns processes with more conveniences in terms of introspection and debugging.

Check the Process module for more process-related functions. For more information on linking, check Process.link/1.

The anonymous function receives 0 arguments, and may return any value.

Inlined by the compiler.

Examples

current = self()
child = spawn_link(fn -> send(current, {self(), 1 + 2}) end)

receive do
  {^child, 3} -> IO.puts("Received 3 back")
end
Link to this function

spawn_link(module, fun, args)

View Source

Specs

spawn_link(module(), atom(), list()) :: pid()

Spawns the given function fun from the given module passing it the given args, links it to the current process, and returns its PID.

Typically developers do not use the spawn functions, instead they use abstractions such as Task, GenServer and Agent, built on top of spawn, that spawns processes with more conveniences in terms of introspection and debugging.

Check the Process module for more process-related functions. For more information on linking, check Process.link/1.

Inlined by the compiler.

Examples

spawn_link(SomeModule, :function, [1, 2, 3])