dejafu-0.6.0.0: Systematic testing for Haskell concurrency.

Copyright(c) 2016 Michael Walker
LicenseMIT
MaintainerMichael Walker <mike@barrucadu.co.uk>
Stabilityexperimental
PortabilityRankNTypes, ScopedTypeVariables
Safe HaskellNone
LanguageHaskell2010

Test.DejaFu.Conc.Internal

Contents

Description

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.

Synopsis

Execution

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.

data Context n r g Source #

The context a collection of threads are running in.

Constructors

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

data Act Source #

What a thread did.

Constructors

Single ThreadAction

Just one action.

SubC SeqTrace (Maybe (ThreadId, ThreadAction))

Subconcurrency, with the given trace and final action.

Instances

Eq Act Source # 

Methods

(==) :: Act -> Act -> Bool #

(/=) :: Act -> Act -> Bool #

Show Act Source # 

Methods

showsPrec :: Int -> Act -> ShowS #

show :: Act -> String #

showList :: [Act] -> ShowS #

stepThread Source #

Arguments

:: MonadRef r n 
=> Scheduler g

The scheduler.

-> MemType

The memory model to use.

-> ThreadId

ID of the current thread

-> Action n r

Action to step

-> Context n r g

The execution context.

-> n (Either Failure (Context n r g), Act) 

Run a single thread one step, by dispatching on the type of Action.