Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Consensus.Util.STM
Synopsis
- data Watcher m a fp = Watcher { }
- forkLinkedWatcher :: forall m a fp. ( IOLike m, Eq fp, HasCallStack ) => ResourceRegistry m -> String -> Watcher m a fp -> m ( Thread m Void )
- withWatcher :: forall m a fp r. ( IOLike m, Eq fp, HasCallStack ) => String -> Watcher m a fp -> m r -> m r
- newtype Fingerprint = Fingerprint Word64
-
data
WithFingerprint
a =
WithFingerprint
{
- forgetFingerprint :: !a
- getFingerprint :: ! Fingerprint
- blockUntilAllJust :: MonadSTM m => [ STM m ( Maybe a)] -> STM m [a]
- blockUntilChanged :: forall m a b. ( MonadSTM m, Eq b) => (a -> b) -> b -> STM m a -> STM m (a, b)
- blockUntilJust :: MonadSTM m => STM m ( Maybe a) -> STM m a
- runWhenJust :: IOLike m => ResourceRegistry m -> String -> STM m ( Maybe a) -> (a -> m ()) -> m ()
- newtype Sim n m = Sim { }
- simId :: Sim ( STM m) m
- simStateT :: IOLike m => StrictTVar m st -> Sim n m -> Sim ( StateT st n) m
Watcher
Specification for a thread that watches a variable, and reports interesting changes.
NOTE: STM does not guarantee that
wNotify
will
literally
be called on
every
change: when the system is under heavy load, some updates may be
missed.
Constructors
Watcher | |
Fields
|
Arguments
:: forall m a fp. ( IOLike m, Eq fp, HasCallStack ) | |
=> ResourceRegistry m | |
-> String |
Label for the thread |
-> Watcher m a fp | |
-> m ( Thread m Void ) |
Spawn a new thread that runs a
Watcher
The thread will be linked to the registry.
Arguments
:: forall m a fp r. ( IOLike m, Eq fp, HasCallStack ) | |
=> String |
Label for the thread |
-> Watcher m a fp | |
-> m r | |
-> m r |
Misc
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
|
Instances
blockUntilChanged :: forall m a b. ( MonadSTM m, Eq b) => (a -> b) -> b -> STM m a -> STM m (a, b) Source #
Wait until the TVar changed
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.