summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/Ptr.hs
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2020-09-25 15:58:36 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-10-07 15:00:20 -0400
commitb41f7c3814b2e0e765311babc851cd3d9b6a78d8 (patch)
treeff0dd8327fb48f68e5351cb8501d4bac16c32668 /libraries/base/GHC/Ptr.hs
parent5fc4243bf2da2adbae3d01d163053e8895bc52d9 (diff)
downloadhaskell-b41f7c3814b2e0e765311babc851cd3d9b6a78d8.tar.gz
WinIO: Small changes related to atomic request swaps.
Move the atomix exchange over the Ptr type to an internal module. Fix a bug caused by us passing ptr-to-ptr instead of ptr to atomic exchange. Renamed interlockedExchange to exchangePtr. I've also added an cas primitive. It turned out we don't need it for WinIO but I'm leaving it in as it's useful for other things.
Diffstat (limited to 'libraries/base/GHC/Ptr.hs')
-rw-r--r--libraries/base/GHC/Ptr.hs12
1 files changed, 0 insertions, 12 deletions
diff --git a/libraries/base/GHC/Ptr.hs b/libraries/base/GHC/Ptr.hs
index 6cbcc07ddc..f19e7b90c8 100644
--- a/libraries/base/GHC/Ptr.hs
+++ b/libraries/base/GHC/Ptr.hs
@@ -25,8 +25,6 @@ module GHC.Ptr (
-- * Unsafe functions
castFunPtrToPtr, castPtrToFunPtr,
- -- * Atomic operations
- exchangePtr
) where
import GHC.Base
@@ -165,16 +163,6 @@ castPtrToFunPtr :: Ptr a -> FunPtr b
castPtrToFunPtr (Ptr addr) = FunPtr addr
------------------------------------------------------------------------
--- Atomic operations for Ptr
-
-{-# INLINE exchangePtr #-}
-exchangePtr :: Ptr (Ptr a) -> Ptr b -> IO (Ptr c)
-exchangePtr (Ptr dst) (Ptr val) =
- IO $ \s ->
- case (interlockedExchangeAddr# dst val s) of
- (# s2, old_val #) -> (# s2, Ptr old_val #)
-
-------------------------------------------------------------------------
-- Show instances for Ptr and FunPtr
-- | @since 2.01