Kernel.spawn_monitor

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

Specs

spawn_monitor((() -> any())) :: {pid(), reference()}

Spawns the given function, monitors it and returns its PID and monitoring reference.

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.

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

Inlined by the compiler.

Examples

current = self()
spawn_monitor(fn -> send(current, {self(), 1 + 2}) end)
Link to this function

spawn_monitor(module, fun, args)

View Source

Specs

spawn_monitor(module(), atom(), list()) :: {pid(), reference()}

Spawns the given module and function passing the given args, monitors it and returns its PID and monitoring reference.

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.

Inlined by the compiler.

Examples

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