Skip to content

Commit

Permalink
Add section to Process.exit/2 with differences to Kernel.exit/1 (#14238)
Browse files Browse the repository at this point in the history
  • Loading branch information
fcevado authored and josevalim committed Jan 29, 2025
1 parent 4b09a83 commit 120467f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/elixir/lib/process.ex
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,16 @@ defmodule Process do
Inlined by the compiler.
> #### Differences to `Kernel.exit/1` {: .info }
>
> The functions `Kernel.exit/1` and `Process.exit/2` are
> named similarly but provide very different functionalities. The
> `Kernel:exit/1` function should be used when the intent is to stop the current
> process while `Process.exit/2` should be used when the intent is to send an
> exit signal to another process. Note also that `Kernel.exit/1` can be caught
> with `try/1` while `Process.exit/2` can only be handled by trapping exits and
> when the signal is different than `:kill`.
## Examples
Process.exit(pid, :kill)
Expand Down

0 comments on commit 120467f

Please # to comment.