Process.send_after

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

send_after(dest, msg, time, opts \\ [])

View Source

Specs

send_after(pid() | atom(), term(), non_neg_integer(), [option]) :: reference()
when option: {:abs, boolean()}

Sends msg to dest after time milliseconds.

If dest is a PID, it must be the PID of a local process, dead or alive. If dest is an atom, it must be the name of a registered process which is looked up at the time of delivery. No error is produced if the name does not refer to a process.

The message is not sent immediately. Therefore, dest can receive other messages in-between even when time is 0.

This function returns a timer reference, which can be read with read_timer/1 or canceled with cancel_timer/1.

The timer will be automatically canceled if the given dest is a PID which is not alive or when the given PID exits. Note that timers will not be automatically canceled when dest is an atom (as the atom resolution is done on delivery).

Inlined by the compiler.

Options

  • :abs - (boolean) when false, time is treated as relative to the current monotonic time. When true, time is the absolute value of the Erlang monotonic time at which msg should be delivered to dest. To read more about Erlang monotonic time and other time-related concepts, look at the documentation for the System module. Defaults to false.

Examples

timer_ref = Process.send_after(pid, :hi, 1000)