dejafu-1.11.0.4: A library for unit-testing concurrent programs.

Copyright(c) 2015--2018 Michael Walker
LicenseMIT
MaintainerMichael Walker <mike@barrucadu.co.uk>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Test.DejaFu.SCT.Internal.Weighted

Contents

Description

Internal types and functions for SCT via weighted random scheduling. This module is NOT considered to form part of the public interface of this library.

Synopsis

Weighted random scheduler

data RandSchedState g Source #

The scheduler state

Constructors

RandSchedState 

Fields

Instances
Eq g => Eq (RandSchedState g) Source # 
Instance details

Defined in Test.DejaFu.SCT.Internal.Weighted

Show g => Show (RandSchedState g) Source # 
Instance details

Defined in Test.DejaFu.SCT.Internal.Weighted

Generic (RandSchedState g) Source # 
Instance details

Defined in Test.DejaFu.SCT.Internal.Weighted

Associated Types

type Rep (RandSchedState g) :: Type -> Type #

NFData g => NFData (RandSchedState g) Source # 
Instance details

Defined in Test.DejaFu.SCT.Internal.Weighted

Methods

rnf :: RandSchedState g -> () #

type Rep (RandSchedState g) Source # 
Instance details

Defined in Test.DejaFu.SCT.Internal.Weighted

type Rep (RandSchedState g) = D1 (MetaData "RandSchedState" "Test.DejaFu.SCT.Internal.Weighted" "dejafu-1.11.0.4-ihntBzpLmQ6f879Tk0Ayj" False) (C1 (MetaCons "RandSchedState" PrefixI True) (S1 (MetaSel (Just "schedWeights") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map ThreadId Int)) :*: S1 (MetaSel (Just "schedGen") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 g)))

initialRandSchedState :: g -> RandSchedState g Source #

Initial weighted random scheduler state.

randSched :: RandomGen g => (g -> (Int, g)) -> Scheduler (RandSchedState g) Source #

Weighted random scheduler: assigns to each new thread a weight, and makes a weighted random choice out of the runnable threads at every step.