Skip to content

Commit 9ae49bc

Browse files
authored
docs: add v1.7 compat for @atomic and fix links (#41873)
1 parent ab600f8 commit 9ae49bc

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

base/expr.jl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ result into the field in the first argument and return the values `(old, new)`.
505505
This operation translates to a `modifyproperty!(a.b, :x, func, arg2)` call.
506506
507507
508-
See [atomics](#man-atomics) in the manual for more details.
508+
See [Per-field atomics](@ref man-atomics) section in the manual for more details.
509509
510510
```jldoctest
511511
julia> mutable struct Atomic{T}; @atomic x::T; end
@@ -534,6 +534,9 @@ julia> @atomic max(a.x, 10) # change field x of a to the max value, with sequent
534534
julia> @atomic a.x max 5 # again change field x of a to the max value, with sequential consistency
535535
10 => 10
536536
```
537+
538+
!!! compat "Julia 1.7"
539+
This functionality requires at least Julia 1.7.
537540
"""
538541
macro atomic(ex)
539542
if !isa(ex, Symbol) && !is_expr(ex, :(::))
@@ -601,7 +604,7 @@ Stores `new` into `a.b.x` and returns the old value of `a.b.x`.
601604
602605
This operation translates to a `swapproperty!(a.b, :x, new)` call.
603606
604-
See [atomics](#man-atomics) in the manual for more details.
607+
See [Per-field atomics](@ref man-atomics) section in the manual for more details.
605608
606609
```jldoctest
607610
julia> mutable struct Atomic{T}; @atomic x::T; end
@@ -615,6 +618,9 @@ julia> @atomicswap a.x = 2+2 # replace field x of a with 4, with sequential cons
615618
julia> @atomic a.x # fetch field x of a, with sequential consistency
616619
4
617620
```
621+
622+
!!! compat "Julia 1.7"
623+
This functionality requires at least Julia 1.7.
618624
"""
619625
macro atomicswap(order, ex)
620626
order isa QuoteNode || (order = esc(order))
@@ -644,7 +650,7 @@ replacement was completed.
644650
645651
This operation translates to a `replaceproperty!(a.b, :x, expected, desired)` call.
646652
647-
See [atomics](#man-atomics) in the manual for more details.
653+
See [Per-field atomics](@ref man-atomics) section in the manual for more details.
648654
649655
```jldoctest
650656
julia> mutable struct Atomic{T}; @atomic x::T; end
@@ -669,6 +675,9 @@ julia> @atomicreplace a.x xchg
669675
julia> @atomic a.x # fetch field x of a, with sequential consistency
670676
0
671677
```
678+
679+
!!! compat "Julia 1.7"
680+
This functionality requires at least Julia 1.7.
672681
"""
673682
macro atomicreplace(success_order, fail_order, ex, old_new)
674683
fail_order isa QuoteNode || (fail_order = esc(fail_order))

doc/src/manual/multi-threading.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ orderings (:monotonic, :acquire, :release, :acquire\_release, or
249249
with an atomic ordering constraint, or will be done with monotonic (relaxed)
250250
ordering if unspecified.
251251

252+
!!! compat "Julia 1.7"
253+
Per-field atomics requires at least Julia 1.7.
254+
252255

253256
## Side effects and mutable function arguments
254257

0 commit comments

Comments
 (0)