Atomic.Loc(3) OCaml library Atomic.Loc(3)

# [NAME](#NAME)

Atomic.Loc - Atomic "locations", such as record fields.

# [Module](#Module)

Module Atomic.Loc

# [Documentation](#Documentation)

Module **Loc**  
: **sig end**

Atomic "locations", such as record fields.

**Since** 5.4

*type* **'a** *t* = **'a atomic\_loc**

This module exposes a dedicated type **'a Atomic.Loc.t** for atomic locations (storing a value of type **'a** ) inside objects that may not be atomic references. It is used in particular for atomic record fields: if a record **r** has an atomic field **f** of type **foo** , then **\[%atomic.loc r.f]** has type **foo Atomic.Loc.t** .

The API below mirrors the API to access **Atomic.Loc.t** , see the documentation above for more information.

*val get* : **'a t -&gt; 'a**

*val set* : **'a t -&gt; 'a -&gt; unit**

*val exchange* : **'a t -&gt; 'a -&gt; 'a**

*val compare\_and\_set* : **'a t -&gt; 'a -&gt; 'a -&gt; bool**

*val fetch\_and\_add* : **int t -&gt; int -&gt; int**

*val incr* : **int t -&gt; unit**

*val decr* : **int t -&gt; unit**

2026-10-01 OCamldoc

---

Document: Atomic.Loc(3o) from ocaml 5.5.1-r1 (Chainguard OS)
Source: https://github.com/ocaml/ocaml
