Safe Haskell | Safe-Infered |
---|
This module exposes the internals of the Par
monad so that you
can build your own scheduler or other extensions. Do not use this
module for purposes other than extending the Par
monad with new
functionality.
- data Trace
- data Sched = Sched {}
- newtype Par a = Par {}
- newtype IVar a = IVar (IORef (IVarContents a))
- data IVarContents a
- sched :: Bool -> WorkLimit -> Sched -> IORef [Trace] -> UId -> Trace -> IO ()
- runPar :: Par a -> a
- runParAsync :: Par a -> a
- runParAsyncHelper :: Par a -> (a, IO ())
- new :: Par (IVar a)
- newFull :: NFData a => a -> Par (IVar a)
- newFull_ :: a -> Par (IVar a)
- get :: IVar a -> Par a
- put_ :: IVar a -> a -> Par ()
- put :: NFData a => IVar a -> a -> Par ()
- pollIVar :: IVar a -> IO (Maybe a)
- yield :: Par ()
Documentation
IVar (IORef (IVarContents a)) |
sched :: Bool -> WorkLimit -> Sched -> IORef [Trace] -> UId -> Trace -> IO ()Source
The main scheduler loop. This takes the synchrony flag, our Sched, the particular work queue we're currently working on, the uid of the work queue (for pushing work), our work limit, and the already-popped, first trace in the work queue.
INVARIANT: This should only be called by threads who ARE currently marked as working.
runParAsync :: Par a -> aSource
An asynchronous version in which the main thread of control in a Par computation can return while forked computations still run in the background.