dejafu-1.4.0.0: 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 # 
Show g => Show (RandSchedState g) Source # 
Generic (RandSchedState g) Source # 

Associated Types

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

NFData g => NFData (RandSchedState g) Source # 

Methods

rnf :: RandSchedState g -> () #

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

initialRandSchedState :: Maybe (Map ThreadId Int) -> 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.