Safe Haskell | Trustworthy |
---|---|
Language | Haskell98 |
Unbounded FIFO channels in the LIO
monad. As with other objects in
LIO, a channel has an associated label that is used to impose
restrictions on its operations. In fact, labeled channels (LChan
s)
are simply labeled Chan
s with read and write access restricted
according to the label. This module is analogous to
Control.Concurrent.Chan, but the operations take place in the LIO
monad.
- type LChan l a = LObj l (Chan a)
- newLChan :: Label l => l -> LIO l (LChan l a)
- newLChanP :: PrivDesc l p => Priv p -> l -> LIO l (LChan l a)
- readLChan :: Label l => LChan l a -> LIO l a
- readLChanP :: PrivDesc l p => Priv p -> LChan l a -> LIO l a
- writeLChan :: Label l => LChan l a -> a -> LIO l ()
- writeLChanP :: PrivDesc l p => Priv p -> LChan l a -> a -> LIO l ()
- dupLChan :: Label l => LChan l a -> LIO l (LChan l a)
- dupLChanP :: PrivDesc l p => Priv p -> LChan l a -> LIO l (LChan l a)
Documentation
type LChan l a = LObj l (Chan a) Source #
A LChan
is a labeled channel, i.e., an unbounded FIFO channel.
Basic Functions
Create labeled IORef
s
newLChan :: Label l => l -> LIO l (LChan l a) Source #
Create a new labeled channel. Note that the supplied label must
be above the current label and below the current clearance. An
exception will be thrown by the underlying guardAlloc
if this is
not the case.
newLChanP :: PrivDesc l p => Priv p -> l -> LIO l (LChan l a) Source #
Same as newLChan
except it takes a set of privileges which are
accounted for in comparing the label of the Chan to the current label.
Read LChan
s
readLChan :: Label l => LChan l a -> LIO l a Source #
Read the next value from the channel. The current label is raised to join of the channel label and current label. Howerver, the label of the channel must be below the current clearance.
readLChanP :: PrivDesc l p => Priv p -> LChan l a -> LIO l a Source #
Same as readLChan
, but takes a privilege object which is used
when the current label is raised to avoid over-taining the context.
Write LChan
s
writeLChan :: Label l => LChan l a -> a -> LIO l () Source #
Write value to the labeled channel. The label of the channel must be bounded by the current label and clearance.
writeLChanP :: PrivDesc l p => Priv p -> LChan l a -> a -> LIO l () Source #
Same as writeLChan
, but uses privileges when comparing the
current label to the label of the channel.