Safe Haskell | None |
---|
- data KickChan v a
- newKickChan :: (MVector v' a, v ~ v' RealWorld) => Int -> IO (KickChan v a)
- kcSize :: KickChan v a -> Int
- putKickChan :: (MVector v' a, v ~ v' RealWorld) => KickChan v a -> a -> IO ()
- invalidateKickChan :: KickChan v a -> IO ()
- data KCReader v a
- newReader :: KickChan v a -> IO (KCReader v a)
- readNext :: (MVector v' a, v ~ v' RealWorld) => KCReader v a -> IO (Maybe a)
- currentLag :: KCReader v a -> IO Int
- type KickChanS a = KickChan (MVector RealWorld) a
- type KickChanV a = KickChan (MVector RealWorld) a
- type KickChanU a = KickChan (MVector RealWorld) a
- kcUnboxed :: KickChan (MVector RealWorld) a -> KickChan (MVector RealWorld) a
- kcStorable :: KickChan (MVector RealWorld) a -> KickChan (MVector RealWorld) a
- kcDefault :: KickChan (MVector RealWorld) a -> KickChan (MVector RealWorld) a
- type KCReaderS a = KCReader (MVector RealWorld) a
- type KCReaderV a = KCReader (MVector RealWorld) a
- type KCReaderU a = KCReader (MVector RealWorld) a
Kick Channels
A Channel that drops elements from the end when a KCReader
lags too far
behind the writer.
Creation
newKickChan :: (MVector v' a, v ~ v' RealWorld) => Int -> IO (KickChan v a)Source
Create a new KickChan
of the requested size. The actual size will be
rounded up to the next highest power of 2.
The stored size will have one subtracted, because that's the value we use
for masking, which is the most common operation.
Writing
invalidateKickChan :: KickChan v a -> IO ()Source
Invalidate all current readers on a channel.
Reading
readNext :: (MVector v' a, v ~ v' RealWorld) => KCReader v a -> IO (Maybe a)Source
get the next value from a KCReader
. This function will block if the next
value is not yet available.
if Nothing is returned, the reader has lagged the writer and values have been dropped.
currentLag :: KCReader v a -> IO IntSource
type constraint helpers
kcUnboxed :: KickChan (MVector RealWorld) a -> KickChan (MVector RealWorld) aSource
Constrain a KickChan to work with an Unboxed
data storage
kcStorable :: KickChan (MVector RealWorld) a -> KickChan (MVector RealWorld) aSource
Constrain a KickChan to work with a Storable
data storage