lio- Labeled IO Information Flow Control Library

Safe HaskellUnsafe



This module exports LabeledResults which are effectively thread exit results protected by a label. See LIO.Concurrent for a description of the concurrency abstractions of LIO.



data LabeledResult l a Source

A labeled thread result is simply a wrapper for a LMVar. A thread can observe the result of another thread, only after raising its label to the label of the result.




lresThreadIdTCB :: ThreadId

Thread executing the computation

lresResultTCB :: LMVar l (Either (LabeledException l) a)

Plecement of computation result

data ThreadId

A ThreadId is an abstract type representing a handle to a thread. ThreadId is an instance of Eq, Ord and Show, where the Ord instance implements an arbitrary total ordering over ThreadIds. The Show instance lets you convert an arbitrary-valued ThreadId to string form; showing a ThreadId value is occasionally useful when debugging or diagnosing the behaviour of a concurrent program.

Note: in GHC, if you have a ThreadId, you essentially have a pointer to the thread itself. This means the thread itself can't be garbage collected until you drop the ThreadId. This misfeature will hopefully be corrected at a later date.

Note: Hugs does not provide any operations on other threads; it defines ThreadId as a synonym for ().