# Is there a way to tell at runtime if a struct field is atomic?

**URL:** <https://discourse.julialang.org/t/is-there-a-way-to-tell-at-runtime-if-a-struct-field-is-atomic/138377>\
**Category:** General Usage\
**Tags:** multithreading, atomic\
**Created:** [July 20, 2026, 2:47pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-tell-at-runtime-if-a-struct-field-is-atomic/138377 "2026-07-20T14:47:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![AwesomeQuest](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/awesomequest/32/38910_2.png) [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Post date:** [July 20, 2026, 2:47pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-tell-at-runtime-if-a-struct-field-is-atomic/138377/1 "2026-07-20T14:47:06Z")

</div>

When one makes a struct like

```julia-auto
mutable struct Status
    @atomic st::Symbol
    # other fields
end

```

Is there a way to tell that `st` is a special field? Since `fieldtypes` gives no additional information.

```julia-auto
julia> fieldtypes(Status)
(Symbol,)

```

Should there be an `isatomic` function?

---

<div class="post-metadata">

**Author:** ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)\
**Post date:** [July 20, 2026, 2:52pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-tell-at-runtime-if-a-struct-field-is-atomic/138377/2 "2026-07-20T14:52:54Z")

</div>

You can use `Base.isfieldatomic`, it tells you exactly that:

```julia-auto
julia> Base.isfieldatomic(Status, :st)
true

```

---

<div class="post-metadata">

**Author:** ![AwesomeQuest](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/awesomequest/32/38910_2.png) [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Post date:** [July 20, 2026, 2:55pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-tell-at-runtime-if-a-struct-field-is-atomic/138377/3 "2026-07-20T14:55:07Z")

</div>

Is this documented anywhere?

---

<div class="post-metadata">

**Author:** ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)\
**Post date:** [July 20, 2026, 3:02pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-tell-at-runtime-if-a-struct-field-is-atomic/138377/4 "2026-07-20T15:02:31Z")

</div>

It’s mentioned here:

> **[Base.isfieldatomic - Essentials · The Julia Language](https://docs.julialang.org/en/v1/base/base/#Base.isfieldatomic)**
>
> Determine whether a field s is declared @atomic in a given type t. | Documentation for The Julia Language.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [July 20, 2026, 3:21pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-tell-at-runtime-if-a-struct-field-is-atomic/138377/5 "2026-07-20T15:21:29Z")

</div>

should arguably be public.

---

<div class="post-metadata">

**Author:** ![tecosaur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tecosaur/32/23206_2.png) [@tecosaur](https://discourse.julialang.org/u/tecosaur)\
**Post date:** [July 21, 2026, 5:20am UTC](https://discourse.julialang.org/t/is-there-a-way-to-tell-at-runtime-if-a-struct-field-is-atomic/138377/6 "2026-07-21T05:20:31Z")

</div>

Ooh, I didn’t know about this. It will be coming to the next About.jl version.

---

<div class="post-metadata">

**Author:** ![PatrickHaecker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/patrickhaecker/32/222891_2.png) [@PatrickHaecker](https://discourse.julialang.org/u/PatrickHaecker)\
**Post date:** [July 23, 2026, 5:36am UTC](https://discourse.julialang.org/t/is-there-a-way-to-tell-at-runtime-if-a-struct-field-is-atomic/138377/7 "2026-07-23T05:36:30Z")

</div>

> [@Oscar\_Smith](#):
>
> should arguably be public

[PR created](https://github.com/JuliaLang/julia/pull/62476)
