# `Lockstep.Process`
[🔗](https://github.com/b-erdem/lockstep/blob/v0.1.0/lib/lockstep/process.ex#L1)

Controller-aware wrappers for `Process.whereis/1`, `Process.register/2`,
`Process.unregister/1`, and `Process.registered/0`.

These rewrite the per-name registry to be **per-node** rather than
BEAM-global, so atom names like `:counter` can refer to different
pids on different simulated cluster nodes. Without this, every name
lives in a single BEAM-wide table and you get spurious
`:already_registered` collisions when the same registered name
legitimately exists on multiple nodes.

Falls through to BEAM's vanilla `Process.*` calls when no Lockstep
controller is in scope.

## Rewriter integration

`Lockstep.Rewriter` rewrites bare `Process.whereis/1`,
`Process.register/2`, `Process.unregister/1`, and `Process.registered/0`
to the corresponding `Lockstep.Process.*` calls.

# `register`

```elixir
@spec register(pid() | atom(), atom()) :: true
```

Register `pid_or_name` under `name` on the registered process's
notional node. Mirrors `Process.register/2`.

Returns `true` on success. Raises `ArgumentError` if the name is
already registered on that node, or if the pid is already
registered under another name.

# `registered`

```elixir
@spec registered() :: [atom()]
```

List atom names registered on the calling process's node. Mirrors
`Process.registered/0`.

# `set_label`

```elixir
@spec set_label(any()) :: :ok
```

Set a debug label on the current process. Mirrors OTP 27+'s
`set_label/1` from the `Process` module but works on older OTPs by
no-op'ing -- the label is purely cosmetic for `:observer` / debug
tooling, so it's safe to ignore.

# `unregister`

```elixir
@spec unregister(atom()) :: true
```

Unregister `name` on the calling process's node. Mirrors
`Process.unregister/1`.

Returns `true` on success. Raises `ArgumentError` if no such name.

# `whereis`

```elixir
@spec whereis(atom()) :: pid() | nil
```

Look up a process registered under `name` on the calling process's
notional cluster node. Returns the pid or `nil`. Mirrors
`Process.whereis/1`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
