Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
Watcher | |
|
:: 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.
:: 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.
Instances
data WithFingerprint a Source #
Store a value together with its fingerprint.
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
:: 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.