diff options
author | Andrew Martin <andrew.thaddeus@gmail.com> | 2019-04-10 21:11:03 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-04-21 09:13:20 -0400 |
commit | 3e963de3775c36e6d3f192bada142f9c7aef81d7 (patch) | |
tree | 04664924f34b5a020431018d3645a8f752b4f17f | |
parent | 6ac5da7844023a896d4e4477ee6429fa0f35c6e4 (diff) | |
download | haskell-3e963de3775c36e6d3f192bada142f9c7aef81d7.tar.gz |
improve docs for casArray and casSmallArray
-rw-r--r-- | compiler/prelude/primops.txt.pp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index cbefe2d25f..e2574a1563 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -1133,7 +1133,14 @@ primop ThawArrayOp "thawArray#" GenPrimOp primop CasArrayOp "casArray#" GenPrimOp MutableArray# s a -> Int# -> a -> a -> State# s -> (# State# s, Int#, a #) - {Unsafe, machine-level atomic compare and swap on an element within an Array.} + {Given an array, an offset in Int units, the expected old value, and + the new value, perform an atomic compare and swap i.e. write the new + value if the current value and the old value are the same pointer. + Returns 0 if the swap succeeds and 1 if it fails. Returns the value of + the element before the operation. Implies a full memory barrier. The + use of a pointer equality on a lifted value makes this function harder + to use correctly than {\tt casIntArray\#}. + } with out_of_line = True has_side_effects = True |