[commit: testsuite] master: Update compareAndSwap for new comparison primops (713706e)

git at git.haskell.org git at git.haskell.org
Mon Sep 30 13:01:09 CEST 2013


Repository : ssh://git@git.haskell.org/testsuite

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/713706e4f0da1eb69f8e458cb0744e4ffa8ef8d1/testsuite

>---------------------------------------------------------------

commit 713706e4f0da1eb69f8e458cb0744e4ffa8ef8d1
Author: Reid Barton <rwbarton at gmail.com>
Date:   Sun Sep 29 16:36:54 2013 -0400

    Update compareAndSwap for new comparison primops


>---------------------------------------------------------------

713706e4f0da1eb69f8e458cb0744e4ffa8ef8d1
 tests/concurrent/should_run/compareAndSwap.hs |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/concurrent/should_run/compareAndSwap.hs b/tests/concurrent/should_run/compareAndSwap.hs
index a55734a..ac6c6b1 100644
--- a/tests/concurrent/should_run/compareAndSwap.hs
+++ b/tests/concurrent/should_run/compareAndSwap.hs
@@ -19,7 +19,7 @@ import Control.Monad
 casArrayST :: MutableArray s a -> Int -> a -> a -> ST s (Bool, a)
 casArrayST (MutableArray arr#) (I# i#) old new = ST$ \s1# ->
   case casArray# arr# i# old new s1# of 
-    (# s2#, x#, res #) -> (# s2#, (x# ==# 0#, res) #)
+    (# s2#, x#, res #) -> (# s2#, (isTrue# (x# ==# 0#), res) #)
 
 casSTRef :: STRef s a -- ^ The 'STRef' containing a value 'current'
          -> a -- ^ The 'old' value to compare
@@ -30,7 +30,7 @@ casSTRef (STRef var#) old new = ST $ \s1# ->
    -- Zero means the CAS worked, one that it didn't.
    -- We flip that here:
     case casMutVar# var# old new s1# of
-      (# s2#, x#, res #) -> (# s2#, (x# ==# 0#, res) #)
+      (# s2#, x#, res #) -> (# s2#, (isTrue# (x# ==# 0#), res) #)
 
 -- | Performs a machine-level compare and swap operation on an
 -- 'IORef'. Returns a tuple containing a 'Bool' which is 'True' when a




More information about the ghc-commits mailing list