| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Util.STM
Synopsis
- blockUntilChanged :: forall stm a b. (MonadSTMTx stm, Eq b) => (a -> b) -> b -> stm a -> stm (a, b)
- onEachChange :: forall m a b. (IOLike m, Eq b, HasCallStack) => ResourceRegistry m -> String -> (a -> b) -> Maybe b -> STM m a -> (a -> m ()) -> m (Thread m Void)
- runWhenJust :: IOLike m => ResourceRegistry m -> String -> STM m (Maybe a) -> (a -> m ()) -> m ()
- blockUntilJust :: MonadSTMTx stm => stm (Maybe a) -> stm a
- blockUntilAllJust :: MonadSTMTx stm => [stm (Maybe a)] -> stm [a]
- newtype Fingerprint = Fingerprint Word64
- data WithFingerprint a = WithFingerprint {
- forgetFingerprint :: !a
- getFingerprint :: !Fingerprint
- newtype Sim n m = Sim {}
- simId :: Sim (STM m) m
- simStateT :: IOLike m => StrictTVar m st -> Sim n m -> Sim (StateT st n) m
Misc
blockUntilChanged :: forall stm a b. (MonadSTMTx stm, Eq b) => (a -> b) -> b -> stm a -> stm (a, b) Source #
Wait until the TVar changed
Arguments
| :: forall m a b. (IOLike m, Eq b, HasCallStack) | |
| => ResourceRegistry m | |
| -> String | Label for the thread |
| -> (a -> b) | Obtain a fingerprint |
| -> Maybe b | Optional initial fingerprint
If |
| -> STM m a | |
| -> (a -> m ()) | |
| -> m (Thread m Void) |
Spawn a new thread that runs an action each time an STM value changes.
NOTE: STM does not guarantee that onEachChange will literally be called
on every change: when the system is under heavy load, some updates may
be missed.
The thread will be linked to the registry.
Arguments
| :: IOLike m | |
| => ResourceRegistry m | |
| -> String | Label for the thread |
| -> STM m (Maybe a) | |
| -> (a -> m ()) | |
| -> m () |
Spawn a new thread that waits for an STM value to become Just
The thread will be linked to the registry.
blockUntilJust :: MonadSTMTx stm => stm (Maybe a) -> stm a Source #
blockUntilAllJust :: MonadSTMTx stm => [stm (Maybe a)] -> stm [a] Source #
newtype Fingerprint Source #
Simple type that can be used to indicate something in a TVar is
changed.
Constructors
| Fingerprint Word64 |
Instances
data WithFingerprint a Source #
Store a value together with its fingerprint.
Constructors
| WithFingerprint | |
Fields
| |