| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
System.IO.Streams.Heartbeat
Synopsis
- heartbeatOutputStream :: DiffTime -> a -> OutputStream a -> IO (OutputStream a)
- heartbeatInputStream :: DiffTime -> DiffTime -> InputStream a -> IO (InputStream a)
- data HeartbeatException = MissedHeartbeat DiffTime
Documentation
heartbeatOutputStream Source #
Arguments
| :: DiffTime | Heartbeat interval |
| -> a | Heartbeat message |
| -> OutputStream a | |
| -> IO (OutputStream a) |
Send a message a if nothing has been written on the stream for some interval of time.
Writing Nothing to this OutputStream is required for proper cleanup.
Arguments
| :: DiffTime | Heartbeat interval |
| -> DiffTime | Grace time multiplier |
| -> InputStream a | |
| -> IO (InputStream a) |
Grace period = grace time multiplier x heartbeat interval Usually something like graceMultiplier = 2 is a good idea.
This throws a MissedHeartbeat exception if a heartbeat is not
received within the grace period.
data HeartbeatException Source #
Exception to kill the heartbeat monitoring thread Heartbeat Exceptions carry the grace period, ie. the last time a message was received
Constructors
| MissedHeartbeat DiffTime |
Instances
| Eq HeartbeatException Source # | |
Defined in System.IO.Streams.Heartbeat Methods (==) :: HeartbeatException -> HeartbeatException -> Bool # (/=) :: HeartbeatException -> HeartbeatException -> Bool # | |
| Show HeartbeatException Source # | |
Defined in System.IO.Streams.Heartbeat Methods showsPrec :: Int -> HeartbeatException -> ShowS # show :: HeartbeatException -> String # showList :: [HeartbeatException] -> ShowS # | |
| Exception HeartbeatException Source # | |
Defined in System.IO.Streams.Heartbeat Methods toException :: HeartbeatException -> SomeException # fromException :: SomeException -> Maybe HeartbeatException # | |