Modulelvar-0.1.0.0Haskell2010
Data.LVar
LVar is like Control.Concurrent.STM.TMVar but with a capability for
listening to its changes.
- 2 types
- 8 values
- Packagelvar-0.1.0.0
- Exports10
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceLVar.hs
Types
2 declarationsCreating a LVar
2 declarationsCreate a new LVar with the given initial value
Like new, but there is no initial value. A get will block until an
initial value is set using set or modify
Modifying a LVar
3 declarationsGet the value of the LVar
Set the LVar value; active listeners are automatically notifed.
Modify the LVar value; active listeners are automatically notified.
Listening to a LVar
3 declarationsCreate a listener for changes to the LVar, as they are set by set or
modify from this time onwards.
You must call listenNext to get the next updated value (or current value if
there is one).
Returns a ListenerId that can be used to stop listening later (via
removeListener)
Listen for the next value update (since the last listenNext or
addListener). Unless the LVar was empty when addListener was invoked,
the first invocation of listenNext will return the current value even if
there wasn't an update. Therefore, the *first* call to listenNext will
*always* return immediately, unless the LVar is empty.
Call this in a loop to listen on a series of updates.
Throws ListenerDead if called with a ListenerId that got already removed
by removeListener.
Stop listening to the LVar