Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/elixir/lib/gen_server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,14 @@ defmodule GenServer do
generated atoms won't be garbage-collected. For such cases, you can
set up your own local registry by using the `Registry` module.

For example:

{:ok, _} = Registry.start_link(keys: :unique, name: :stacks)
name = {:via, Registry, {:stacks, "stack 1"}}
{:ok, _pid} = GenServer.start_link(Stack, "hello", name: name)
Registry.lookup(:stacks, "stack 1")
#=> [{#PID<0.150.0>, nil}]

## Receiving "regular" messages

The goal of a `GenServer` is to abstract the "receive" loop for developers,
Expand Down
Loading