Process.spawn

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

Specs

spawn((() -> any()), spawn_opts()) :: pid() | {pid(), reference()}

Spawns the given function according to the given options.

The result depends on the given options. In particular, if :monitor is given as an option, it will return a tuple containing the PID and the monitoring reference, otherwise just the spawned process PID.

More options are available; for the comprehensive list of available options check :erlang.spawn_opt/4.

Inlined by the compiler.

Examples

Process.spawn(fn -> 1 + 2 end, [:monitor])
#=> {#PID<0.93.0>, #Reference<0.18808174.1939079169.202418>}
Process.spawn(fn -> 1 + 2 end, [:link])
#=> #PID<0.95.0>
Link to this function

spawn(mod, fun, args, opts)

View Source

Specs

spawn(module(), atom(), list(), spawn_opts()) :: pid() | {pid(), reference()}

Spawns the given function fun from module mod, passing the given args according to the given options.

The result depends on the given options. In particular, if :monitor is given as an option, it will return a tuple containing the PID and the monitoring reference, otherwise just the spawned process PID.

It also accepts extra options, for the list of available options check :erlang.spawn_opt/4.

Inlined by the compiler.