diff options
author | Edward Z. Yang <ezyang@mit.edu> | 2013-07-10 13:32:15 -0700 |
---|---|---|
committer | Edward Z. Yang <ezyang@mit.edu> | 2013-07-10 13:32:15 -0700 |
commit | db8d4a345ef77bc6832e9496e0ba38c8e36cadff (patch) | |
tree | 7c392036f854725ee3dbc1dfc5056fe28f35027b /compiler/prelude | |
parent | 190d34a68945120f5e283fc1c64ed6fe49710213 (diff) | |
download | haskell-db8d4a345ef77bc6832e9496e0ba38c8e36cadff.tar.gz |
Implement tryAtomicReadMVar#.
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Diffstat (limited to 'compiler/prelude')
-rw-r--r-- | compiler/prelude/primops.txt.pp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 739092d5f5..e5a3e216f1 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -1726,6 +1726,14 @@ primop AtomicReadMVarOp "atomicReadMVar#" GenPrimOp out_of_line = True has_side_effects = True +primop TryAtomicReadMVarOp "tryAtomicReadMVar#" GenPrimOp + MVar# s a -> State# s -> (# State# s, Int#, a #) + {If {\tt MVar\#} is empty, immediately return with integer 0 and value undefined. + Otherwise, return wtih integer 1 and contents of {\tt MVar\#}.} + with + out_of_line = True + has_side_effects = True + primop SameMVarOp "sameMVar#" GenPrimOp MVar# s a -> MVar# s a -> Bool |