Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data LocalArray a
- newLocalArray :: MonadPrimIO m => Int -> a -> m (LocalArray a)
- readLocalArray :: forall m a. (MonadPrimIO m, ReifiesCapability m) => LocalArray a -> Int -> m a
- writeLocalArray :: (MonadPrimIO m, ReifiesCapability m) => LocalArray a -> Int -> a -> m ()
- atomicModifyLocalArray :: (MonadPrimIO m, ReifiesCapability m) => LocalArray a -> Int -> (a -> (a, b)) -> m b
- atomicModifyLocalArray' :: (MonadPrimIO m, ReifiesCapability m) => LocalArray a -> Int -> (a -> (a, b)) -> m b
- modifyLocalArray :: (MonadPrimIO m, ReifiesCapability m) => LocalArray a -> Int -> (a -> a) -> m a
- modifyLocalArray' :: (MonadPrimIO m, ReifiesCapability m) => LocalArray a -> Int -> (a -> a) -> m a
- fetchModifyLocalArray :: (MonadPrimIO m, ReifiesCapability m) => LocalArray a -> Int -> (a -> a) -> m a
- fetchModifyLocalArray' :: (MonadPrimIO m, ReifiesCapability m) => LocalArray a -> Int -> (a -> a) -> m a
- data SmallLocalArray a
- newSmallLocalArray :: MonadPrimIO m => Int -> a -> m (SmallLocalArray a)
- readSmallLocalArray :: forall m a. (MonadPrimIO m, ReifiesCapability m) => SmallLocalArray a -> Int -> m a
- writeSmallLocalArray :: (MonadPrimIO m, ReifiesCapability m) => SmallLocalArray a -> Int -> a -> m ()
- atomicModifySmallLocalArray :: (MonadPrimIO m, ReifiesCapability m) => SmallLocalArray a -> Int -> (a -> (a, b)) -> m b
- atomicModifySmallLocalArray' :: (MonadPrimIO m, ReifiesCapability m) => SmallLocalArray a -> Int -> (a -> (a, b)) -> m b
- modifySmallLocalArray :: (MonadPrimIO m, ReifiesCapability m) => SmallLocalArray a -> Int -> (a -> a) -> m a
- modifySmallLocalArray' :: (MonadPrimIO m, ReifiesCapability m) => SmallLocalArray a -> Int -> (a -> a) -> m a
- fetchModifySmallLocalArray :: (MonadPrimIO m, ReifiesCapability m) => SmallLocalArray a -> Int -> (a -> a) -> m a
- fetchModifySmallLocalArray' :: (MonadPrimIO m, ReifiesCapability m) => SmallLocalArray a -> Int -> (a -> a) -> m a
Capability-Local Arrays
data LocalArray a Source
Capability-Local variables with cache-line spacing
You can _only_ safely access these from code that is pinned to a given capability. Otherwise you might get preempted between when we check the capability # and index into the array. At which point the invariants that ensure that we can operate without a compare-and-swap even on the threaded RTS cease to hold.
newLocalArray :: MonadPrimIO m => Int -> a -> m (LocalArray a) Source
Calling setNumCapabilities
after this is built can cause you to crash when accessing it
and break invariants.
readLocalArray :: forall m a. (MonadPrimIO m, ReifiesCapability m) => LocalArray a -> Int -> m a Source
writeLocalArray :: (MonadPrimIO m, ReifiesCapability m) => LocalArray a -> Int -> a -> m () Source
atomicModifyLocalArray :: (MonadPrimIO m, ReifiesCapability m) => LocalArray a -> Int -> (a -> (a, b)) -> m b Source
This is safely atomic, despite the lack of CAS.
atomicModifyLocalArray' :: (MonadPrimIO m, ReifiesCapability m) => LocalArray a -> Int -> (a -> (a, b)) -> m b Source
This is safely atomic, despite the lack of CAS.
modifyLocalArray :: (MonadPrimIO m, ReifiesCapability m) => LocalArray a -> Int -> (a -> a) -> m a Source
This is safely atomic, despite the lack of CAS.
modifyLocalArray' :: (MonadPrimIO m, ReifiesCapability m) => LocalArray a -> Int -> (a -> a) -> m a Source
This is safely atomic, despite the lack of CAS.
fetchModifyLocalArray :: (MonadPrimIO m, ReifiesCapability m) => LocalArray a -> Int -> (a -> a) -> m a Source
This is safely atomic, despite the lack of CAS.
fetchModifyLocalArray' :: (MonadPrimIO m, ReifiesCapability m) => LocalArray a -> Int -> (a -> a) -> m a Source
This is safely atomic, despite the lack of CAS.
Small Capability-Local Arrays
data SmallLocalArray a Source
newSmallLocalArray :: MonadPrimIO m => Int -> a -> m (SmallLocalArray a) Source
Calling setNumCapabilities
after this is built can cause you to crash when accessing it
and break invariants.
readSmallLocalArray :: forall m a. (MonadPrimIO m, ReifiesCapability m) => SmallLocalArray a -> Int -> m a Source
writeSmallLocalArray :: (MonadPrimIO m, ReifiesCapability m) => SmallLocalArray a -> Int -> a -> m () Source
atomicModifySmallLocalArray :: (MonadPrimIO m, ReifiesCapability m) => SmallLocalArray a -> Int -> (a -> (a, b)) -> m b Source
This is safely atomic, despite the lack of CAS.
atomicModifySmallLocalArray' :: (MonadPrimIO m, ReifiesCapability m) => SmallLocalArray a -> Int -> (a -> (a, b)) -> m b Source
This is safely atomic, despite the lack of CAS.
modifySmallLocalArray :: (MonadPrimIO m, ReifiesCapability m) => SmallLocalArray a -> Int -> (a -> a) -> m a Source
This is safely atomic, despite the lack of CAS.
modifySmallLocalArray' :: (MonadPrimIO m, ReifiesCapability m) => SmallLocalArray a -> Int -> (a -> a) -> m a Source
This is safely atomic, despite the lack of CAS.
fetchModifySmallLocalArray :: (MonadPrimIO m, ReifiesCapability m) => SmallLocalArray a -> Int -> (a -> a) -> m a Source
This is safely atomic, despite the lack of CAS.
fetchModifySmallLocalArray' :: (MonadPrimIO m, ReifiesCapability m) => SmallLocalArray a -> Int -> (a -> a) -> m a Source
This is safely atomic, despite the lack of CAS.