dejafu-0.5.1.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) 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) Source #

Run a collection of threads, until there are no threads left.

Single-step execution

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, Either (ThreadAction, SeqTrace) ThreadAction)) 

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