@@ -1980,24 +1980,23 @@ setfield!
1980
1980
1981
1981
These atomically perform the operations to simultaneously get and set a field:
1982
1982
1983
- y = getfield! (value, name)
1983
+ y = getfield(value, name)
1984
1984
setfield!(value, name, x)
1985
1985
return y
1986
- ```
1987
1986
"""
1988
1987
swapfield!
1989
1988
1990
1989
"""
1991
- modifyfield!(value, name::Symbol, op, x, [order::Symbol])
1992
- modifyfield!(value, i::Int, op, x, [order::Symbol])
1990
+ modifyfield!(value, name::Symbol, op, x, [order::Symbol]) -> Pair
1991
+ modifyfield!(value, i::Int, op, x, [order::Symbol]) -> Pair
1993
1992
1994
1993
These atomically perform the operations to get and set a field after applying
1995
1994
the function `op`.
1996
1995
1997
- y = getfield! (value, name)
1996
+ y = getfield(value, name)
1998
1997
z = op(y, x)
1999
1998
setfield!(value, name, z)
2000
- return y, z
1999
+ return y => z
2001
2000
2002
2001
If supported by the hardware (for example, atomic increment), this may be
2003
2002
optimized to the appropriate hardware instruction, otherwise it'll use a loop.
@@ -2006,18 +2005,19 @@ modifyfield!
2006
2005
2007
2006
"""
2008
2007
replacefield!(value, name::Symbol, expected, desired,
2009
- [success_order::Symbol, [fail_order::Symbol=success_order]) =>
2010
- (old, Bool)
2008
+ [success_order::Symbol, [fail_order::Symbol=success_order]) -> (; old, success::Bool)
2009
+ replacefield!(value, i::Int, expected, desired,
2010
+ [success_order::Symbol, [fail_order::Symbol=success_order]) -> (; old, success::Bool)
2011
2011
2012
2012
These atomically perform the operations to get and conditionally set a field to
2013
2013
a given value.
2014
2014
2015
- y = getfield! (value, name, fail_order)
2015
+ y = getfield(value, name, fail_order)
2016
2016
ok = y === expected
2017
2017
if ok
2018
2018
setfield!(value, name, desired, success_order)
2019
2019
end
2020
- return y, ok
2020
+ return (; old = y, success = ok)
2021
2021
2022
2022
If supported by the hardware, this may be optimized to the appropriate hardware
2023
2023
instruction, otherwise it'll use a loop.
0 commit comments