Copyright | (c) 2016 Michael Walker |
---|---|
License | MIT |
Maintainer | Michael Walker <mike@barrucadu.co.uk> |
Stability | experimental |
Portability | RankNTypes, ScopedTypeVariables |
Safe Haskell | None |
Language | Haskell2010 |
Concurrent monads with a fixed scheduler: internal types and functions. This module is NOT considered to form part of the public interface of this library.
- type SeqTrace = Seq (Decision, [(ThreadId, NonEmpty Lookahead)], ThreadAction)
- runConcurrency :: MonadRef r n => Scheduler g -> MemType -> g -> Int -> M n r a -> n (Either Failure a, g, SeqTrace, Maybe (ThreadId, ThreadAction))
- data Context n r g = Context {
- cSchedState :: g
- cIdSource :: IdSource
- cThreads :: Threads n r
- cWriteBuf :: WriteBuffer r
- cCaps :: Int
- runThreads :: MonadRef r n => Scheduler g -> MemType -> r (Maybe (Either Failure a)) -> Context n r g -> n (Context n r g, SeqTrace, Maybe (ThreadId, ThreadAction))
- data Act
- = Single ThreadAction
- | SubC SeqTrace (Maybe (ThreadId, ThreadAction))
- stepThread :: forall n r g. MonadRef r n => Scheduler g -> MemType -> ThreadId -> Action n r -> Context n r g -> n (Either Failure (Context n r g), Act)
Execution
type SeqTrace = Seq (Decision, [(ThreadId, NonEmpty Lookahead)], ThreadAction) Source #
Trace
but as a sequence.
runConcurrency :: MonadRef r n => Scheduler g -> MemType -> g -> Int -> M n r a -> n (Either Failure a, g, SeqTrace, Maybe (ThreadId, ThreadAction)) Source #
Run a concurrent computation with a given Scheduler
and initial
state, returning a failure reason on error. Also returned is the
final state of the scheduler, and an execution trace.
The context a collection of threads are running in.
Context | |
|
runThreads :: MonadRef r n => Scheduler g -> MemType -> r (Maybe (Either Failure a)) -> Context n r g -> n (Context n r g, SeqTrace, Maybe (ThreadId, ThreadAction)) Source #
Run a collection of threads, until there are no threads left.
Single-step execution
What a thread did.
Single ThreadAction | Just one action. |
SubC SeqTrace (Maybe (ThreadId, ThreadAction)) | Subconcurrency, with the given trace and final action. |