Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
this module provides a simple mechanism for adding IO operations to a queue and running them in a single thread. This is useful if the IO operations have side-effects which could collide if run from multiple threads. For example, creating an image thumbnail and storing it on disk, running LaTeX, etc.
Synopsis
- data IOThread a b = IOThread {
- ioThreadId :: ThreadId
- ioThreadChan :: Chan (a, MVar (Either SomeException b))
- startIOThread :: (a -> IO b) -> IO (IOThread a b)
- killIOThread :: IOThread a b -> IO ()
- ioRequest :: IOThread a b -> a -> IO b
Documentation
IOThread | |
|
start the IO thread.
killIOThread :: IOThread a b -> IO () Source #
kill the IOThread
WARNING: no attempt is made to wait for the queue to empty... we should probably have safer version that waits for the operations to complete?