Copyright | (c) 2017--2021 Michael Walker |
---|---|
License | MIT |
Maintainer | Michael Walker <mike@barrucadu.co.uk> |
Stability | experimental |
Portability | DeriveGeneric, FlexibleInstances, GeneralizedNewtypeDeriving, LambdaCase, RankNTypes, StandaloneDeriving, TypeFamilies |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Common types and functions used throughout DejaFu.
Synopsis
- class MonadThrow m => MonadDejaFu m where
- type Ref m :: Type -> Type
- type BoundThread m :: Type -> Type
- newRef :: a -> m (Ref m a)
- readRef :: Ref m a -> m a
- writeRef :: Ref m a -> a -> m ()
- forkBoundThread :: Maybe (m (BoundThread m a))
- runInBoundThread :: BoundThread m a -> m a -> m a
- killBoundThread :: BoundThread m a -> m ()
- data IOBoundThread a = IOBoundThread {
- iobtRunInBoundThread :: IO a -> IO a
- iobtKillBoundThread :: IO ()
- newtype ThreadId = ThreadId Id
- newtype IORefId = IORefId Id
- newtype MVarId = MVarId Id
- newtype TVarId = TVarId Id
- data Id = Id (Maybe String) !Int
- initialThread :: ThreadId
- data ThreadAction
- = Fork ThreadId
- | ForkOS ThreadId
- | SupportsBoundThreads Bool
- | IsCurrentThreadBound Bool
- | MyThreadId
- | GetNumCapabilities Int
- | SetNumCapabilities Int
- | Yield
- | ThreadDelay Int
- | NewMVar MVarId
- | PutMVar MVarId [ThreadId]
- | BlockedPutMVar MVarId
- | TryPutMVar MVarId Bool [ThreadId]
- | ReadMVar MVarId
- | TryReadMVar MVarId Bool
- | BlockedReadMVar MVarId
- | TakeMVar MVarId [ThreadId]
- | BlockedTakeMVar MVarId
- | TryTakeMVar MVarId Bool [ThreadId]
- | NewIORef IORefId
- | ReadIORef IORefId
- | ReadIORefCas IORefId
- | ModIORef IORefId
- | ModIORefCas IORefId
- | WriteIORef IORefId
- | CasIORef IORefId Bool
- | CommitIORef ThreadId IORefId
- | STM [TAction] [ThreadId]
- | ThrownSTM [TAction] (Maybe MaskingState)
- | BlockedSTM [TAction]
- | Catching
- | PopCatching
- | Throw (Maybe MaskingState)
- | ThrowTo ThreadId (Maybe MaskingState)
- | BlockedThrowTo ThreadId
- | SetMasking Bool MaskingState
- | ResetMasking Bool MaskingState
- | GetMaskingState MaskingState
- | LiftIO
- | Return
- | Stop
- | RegisterInvariant
- data Lookahead
- = WillFork
- | WillForkOS
- | WillSupportsBoundThreads
- | WillIsCurrentThreadBound
- | WillMyThreadId
- | WillGetNumCapabilities
- | WillSetNumCapabilities Int
- | WillYield
- | WillThreadDelay Int
- | WillNewMVar
- | WillPutMVar MVarId
- | WillTryPutMVar MVarId
- | WillReadMVar MVarId
- | WillTryReadMVar MVarId
- | WillTakeMVar MVarId
- | WillTryTakeMVar MVarId
- | WillNewIORef
- | WillReadIORef IORefId
- | WillReadIORefCas IORefId
- | WillModIORef IORefId
- | WillModIORefCas IORefId
- | WillWriteIORef IORefId
- | WillCasIORef IORefId
- | WillCommitIORef ThreadId IORefId
- | WillSTM
- | WillCatching
- | WillPopCatching
- | WillThrow
- | WillThrowTo ThreadId
- | WillSetMasking Bool MaskingState
- | WillResetMasking Bool MaskingState
- | WillGetMaskingState
- | WillLiftIO
- | WillReturn
- | WillStop
- | WillRegisterInvariant
- data TAction
- type Trace = [(Decision, [(ThreadId, Lookahead)], ThreadAction)]
- data Decision
- data Condition
- isAbort :: Condition -> Bool
- isDeadlock :: Condition -> Bool
- isUncaughtException :: Condition -> Bool
- isInvariantFailure :: Condition -> Bool
- data Error
- isSchedulerError :: Error -> Bool
- data Bounds = Bounds {}
- newtype PreemptionBound = PreemptionBound Int
- newtype FairBound = FairBound Int
- newtype LengthBound = LengthBound Int
- data Discard
- newtype Weaken a = Weaken {
- getWeakDiscarder :: Either Condition a -> Maybe Discard
- weakenDiscard :: (Either Condition a -> Maybe Discard) -> (Either Condition a -> Maybe Discard) -> Either Condition a -> Maybe Discard
- newtype Strengthen a = Strengthen {
- getStrongDiscarder :: Either Condition a -> Maybe Discard
- strengthenDiscard :: (Either Condition a -> Maybe Discard) -> (Either Condition a -> Maybe Discard) -> Either Condition a -> Maybe Discard
- data MemType
- newtype MonadFailException = MonadFailException String
- data ConcurrencyState = ConcurrencyState {}
- isBuffered :: ConcurrencyState -> IORefId -> Bool
- numBuffered :: ConcurrencyState -> IORefId -> Int
- isFull :: ConcurrencyState -> MVarId -> Bool
- canInterrupt :: ConcurrencyState -> ThreadId -> ThreadAction -> Bool
- canInterruptL :: ConcurrencyState -> ThreadId -> Lookahead -> Bool
- isMaskedInterruptible :: ConcurrencyState -> ThreadId -> Bool
- isMaskedUninterruptible :: ConcurrencyState -> ThreadId -> Bool
The MonadDejaFu
typeclass
class MonadThrow m => MonadDejaFu m where Source #
The MonadDejaFu
class captures the two things needed to run a
concurrent program which we can't implement in normal Haskell:
mutable references, and the ability to create a bound thread in
IO
.
In addition to needing the operations in this class, dejafu also
needs the ability to throw exceptions, as these are used to
communicate Error
s, so there is a MonadThrow
constraint.
Since: 2.1.0.0
type Ref m :: Type -> Type Source #
The type of mutable references. These references will always
contain a value, and so don't need to handle emptiness (like
MVar
does).
These references are always used from the same Haskell thread, so
it's safe to implement these using unsynchronised primitives with
relaxed-memory behaviours (like IORef
s).
type BoundThread m :: Type -> Type Source #
A handle to a bound thread. If the monad doesn't support bound
threads (for example, if it's not based on IO
), then this
should be some type which can't be constructed, like V1
.
newRef :: a -> m (Ref m a) Source #
Create a new reference holding a given initial value.
readRef :: Ref m a -> m a Source #
Read the current value in the reference.
writeRef :: Ref m a -> a -> m () Source #
Replace the value in the reference.
forkBoundThread :: Maybe (m (BoundThread m a)) Source #
Fork a new bound thread, if the monad supports them.
runInBoundThread :: BoundThread m a -> m a -> m a Source #
Run an action in a previously created bound thread.
killBoundThread :: BoundThread m a -> m () Source #
Terminate a previously created bound thread.
After termination, runInBoundThread
and killBoundThread
will
never be called on this BoundThread m a
value again.
Instances
MonadDejaFu IO Source # | Since: 2.1.0.0 |
Defined in Test.DejaFu.Types | |
MonadDejaFu (CatchT (ST t)) Source # | This instance does not support bound threads. Since: 2.1.0.0 |
Defined in Test.DejaFu.Types newRef :: a -> CatchT (ST t) (Ref (CatchT (ST t)) a) Source # readRef :: Ref (CatchT (ST t)) a -> CatchT (ST t) a Source # writeRef :: Ref (CatchT (ST t)) a -> a -> CatchT (ST t) () Source # forkBoundThread :: Maybe (CatchT (ST t) (BoundThread (CatchT (ST t)) a)) Source # runInBoundThread :: BoundThread (CatchT (ST t)) a -> CatchT (ST t) a -> CatchT (ST t) a Source # killBoundThread :: BoundThread (CatchT (ST t)) a -> CatchT (ST t) () Source # |
data IOBoundThread a Source #
A bound thread in IO
.
Since: 2.1.0.0
IOBoundThread | |
|
Identifiers
Every thread has a unique identitifer.
Since: 1.0.0.0
Every IORef
has a unique identifier.
Since: 1.11.0.0
Every MVar
has a unique identifier.
Since: 1.0.0.0
Every TVar
has a unique identifier.
Since: 1.0.0.0
An identifier for a thread, MVar
, IORef
, or TVar
.
The number is the important bit. The string is to make execution traces easier to read, but is meaningless.
Since: 1.0.0.0
Instances
Generic Id Source # | |
Show Id Source # | |
NFData Id Source # | |
Defined in Test.DejaFu.Types | |
Eq Id Source # | |
Ord Id Source # | |
type Rep Id Source # | Since: 1.3.1.0 |
Defined in Test.DejaFu.Types type Rep Id = D1 ('MetaData "Id" "Test.DejaFu.Types" "dejafu-2.4.0.5-G4EEj1kXZBX5wEYbPUnAst" 'False) (C1 ('MetaCons "Id" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int))) |
initialThread :: ThreadId Source #
The ID of the initial thread.
Since: 0.4.0.0
Actions
data ThreadAction Source #
All the actions that a thread can perform.
Since: 2.2.0.0
Fork ThreadId | Start a new thread. |
ForkOS ThreadId | Start a new bound thread. |
SupportsBoundThreads Bool | Check if bound threads are supported. |
IsCurrentThreadBound Bool | Check if the current thread is bound. |
MyThreadId | Get the |
GetNumCapabilities Int | Get the number of Haskell threads that can run simultaneously. |
SetNumCapabilities Int | Set the number of Haskell threads that can run simultaneously. |
Yield | Yield the current thread. |
ThreadDelay Int | Yield/delay the current thread. |
NewMVar MVarId | Create a new |
PutMVar MVarId [ThreadId] | Put into a |
BlockedPutMVar MVarId | Get blocked on a put. |
TryPutMVar MVarId Bool [ThreadId] | Try to put into a |
ReadMVar MVarId | Read from a |
TryReadMVar MVarId Bool | Try to read from a |
BlockedReadMVar MVarId | Get blocked on a read. |
TakeMVar MVarId [ThreadId] | Take from a |
BlockedTakeMVar MVarId | Get blocked on a take. |
TryTakeMVar MVarId Bool [ThreadId] | Try to take from a |
NewIORef IORefId | Create a new |
ReadIORef IORefId | Read from a |
ReadIORefCas IORefId | Read from a |
ModIORef IORefId | Modify a |
ModIORefCas IORefId | Modify a |
WriteIORef IORefId | Write to a |
CasIORef IORefId Bool | Attempt to to a |
CommitIORef ThreadId IORefId | Commit the last write to the given |
STM [TAction] [ThreadId] | An STM transaction was executed, possibly waking up some threads. |
ThrownSTM [TAction] (Maybe MaskingState) | An STM transaction threw an exception. Give the resultant masking state after jumping to the exception handler (if the thread is still alive). |
BlockedSTM [TAction] | Got blocked in an STM transaction. |
Catching | Register a new exception handler |
PopCatching | Pop the innermost exception handler from the stack. |
Throw (Maybe MaskingState) | Throw an exception, and give the resultant masking state after jumping to the exception handler (if the thread is still alive). |
ThrowTo ThreadId (Maybe MaskingState) | Throw an exception to a thread, and give the resultant masking state after jumping to the exception handler (if the thread is still alive). |
BlockedThrowTo ThreadId | Get blocked on a |
SetMasking Bool MaskingState | Set the masking state. If |
ResetMasking Bool MaskingState | Return to an earlier masking state. If |
GetMaskingState MaskingState | Get the current masking state. |
LiftIO | Lift an IO action. Note that this can only happen with
|
Return | |
Stop | Cease execution and terminate. |
RegisterInvariant | Register an invariant. |
Instances
A one-step look-ahead at what a thread will do next.
Since: 2.2.0.0
WillFork | Will start a new thread. |
WillForkOS | Will start a new bound thread. |
WillSupportsBoundThreads | Will check if bound threads are supported. |
WillIsCurrentThreadBound | Will check if the current thread is bound. |
WillMyThreadId | Will get the |
WillGetNumCapabilities | Will get the number of Haskell threads that can run simultaneously. |
WillSetNumCapabilities Int | Will set the number of Haskell threads that can run simultaneously. |
WillYield | Will yield the current thread. |
WillThreadDelay Int | Will yield/delay the current thread. |
WillNewMVar | Will create a new |
WillPutMVar MVarId | Will put into a |
WillTryPutMVar MVarId | Will try to put into a |
WillReadMVar MVarId | Will read from a |
WillTryReadMVar MVarId | Will try to read from a |
WillTakeMVar MVarId | Will take from a |
WillTryTakeMVar MVarId | Will try to take from a |
WillNewIORef | Will create a new |
WillReadIORef IORefId | Will read from a |
WillReadIORefCas IORefId | Will read from a |
WillModIORef IORefId | Will modify a |
WillModIORefCas IORefId | Will modify a |
WillWriteIORef IORefId | Will write to a |
WillCasIORef IORefId | Will attempt to to a |
WillCommitIORef ThreadId IORefId | Will commit the last write by the given thread to the |
WillSTM | Will execute an STM transaction, possibly waking up some threads. |
WillCatching | Will register a new exception handler |
WillPopCatching | Will pop the innermost exception handler from the stack. |
WillThrow | Will throw an exception. |
WillThrowTo ThreadId | Will throw an exception to a thread. |
WillSetMasking Bool MaskingState | Will set the masking state. If |
WillResetMasking Bool MaskingState | Will return to an earlier masking state. If |
WillGetMaskingState | Will get the masking state. |
WillLiftIO | Will lift an IO action. Note that this can only happen with
|
WillReturn | |
WillStop | Will cease execution and terminate. |
WillRegisterInvariant | Will register an invariant |
Instances
All the actions that an STM transaction can perform.
Since: 0.8.0.0
TNew TVarId | Create a new |
TRead TVarId | Read from a |
TWrite TVarId | Write to a |
TRetry | Abort and discard effects. |
TOrElse [TAction] (Maybe [TAction]) | Execute a transaction. If the transaction aborts by calling
|
TThrow | Throw an exception, abort, and discard effects. |
TCatch [TAction] (Maybe [TAction]) | Execute a transaction. If the transaction aborts by throwing an exception of the appropriate type, it is handled and execution continues; otherwise aborts, propagating the exception upwards. |
TStop | Terminate successfully and commit effects. |
Instances
Traces
type Trace = [(Decision, [(ThreadId, Lookahead)], ThreadAction)] Source #
One of the outputs of the runner is a Trace
, which is a log of
decisions made, all the alternative unblocked threads and what they
would do, and the action a thread took in its step.
Since: 0.8.0.0
Scheduling decisions are based on the state of the running program, and so we can capture some of that state in recording what specific decision we made.
Since: 0.5.0.0
Start ThreadId | Start a new thread, because the last was blocked (or it's the start of computation). |
Continue | Continue running the last thread for another step. |
SwitchTo ThreadId | Pre-empt the running thread, and switch to another. |
Instances
Generic Decision Source # | |
Show Decision Source # | |
NFData Decision Source # | Since: 0.5.1.0 |
Defined in Test.DejaFu.Types | |
Eq Decision Source # | |
type Rep Decision Source # | Since: 1.3.1.0 |
Defined in Test.DejaFu.Types type Rep Decision = D1 ('MetaData "Decision" "Test.DejaFu.Types" "dejafu-2.4.0.5-G4EEj1kXZBX5wEYbPUnAst" 'False) (C1 ('MetaCons "Start" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ThreadId)) :+: (C1 ('MetaCons "Continue" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SwitchTo" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ThreadId)))) |
Conditions
An indication of how a concurrent computation terminated, if it didn't produce a value.
The Eq
, Ord
, and NFData
instances compare/evaluate the
exception with show
in the UncaughtException
and
InvariantFailure
cases.
Since: 2.0.0.0
Abort | The scheduler chose to abort execution. This will be produced if, for example, all possible decisions exceed the specified bounds (there have been too many pre-emptions, the computation has executed for too long, or there have been too many yields). |
Deadlock | Every thread is blocked |
UncaughtException SomeException | An uncaught exception bubbled to the top of the computation. |
InvariantFailure SomeException | An uncaught exception caused an invariant to fail. |
Instances
Generic Condition Source # | |
Show Condition Source # | |
NFData Condition Source # | |
Defined in Test.DejaFu.Types | |
Eq Condition Source # | |
Ord Condition Source # | |
Defined in Test.DejaFu.Types | |
type Rep Condition Source # | |
Defined in Test.DejaFu.Types type Rep Condition = D1 ('MetaData "Condition" "Test.DejaFu.Types" "dejafu-2.4.0.5-G4EEj1kXZBX5wEYbPUnAst" 'False) ((C1 ('MetaCons "Abort" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Deadlock" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "UncaughtException" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SomeException)) :+: C1 ('MetaCons "InvariantFailure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SomeException)))) |
isDeadlock :: Condition -> Bool Source #
Check if a condition is a Deadlock
.
Since: 0.9.0.0
isUncaughtException :: Condition -> Bool Source #
Check if a condition is an UncaughtException
Since: 0.9.0.0
isInvariantFailure :: Condition -> Bool Source #
Check if a condition is an InvariantFailure
Since: 2.0.0.0
Errors
An indication that there is a bug in dejafu or you are using it incorrectly.
Since: 2.0.0.0
ScheduledBlockedThread | Raised as an exception if the scheduler attempts to schedule a blocked thread. |
ScheduledMissingThread | Raised as an exception if the scheduler attempts to schedule a nonexistent thread. |
Instances
Bounded Error Source # | |
Enum Error Source # | |
Exception Error Source # | |
Defined in Test.DejaFu.Types toException :: Error -> SomeException # fromException :: SomeException -> Maybe Error # displayException :: Error -> String # | |
Generic Error Source # | |
Show Error Source # | |
Eq Error Source # | |
Ord Error Source # | |
type Rep Error Source # | |
isSchedulerError :: Error -> Bool Source #
Check if an error is a scheduler error.
Since: 1.12.0.0
Schedule bounding
Since: 2.0.0.0
Instances
Generic Bounds Source # | |
Read Bounds Source # | |
Show Bounds Source # | |
NFData Bounds Source # | |
Defined in Test.DejaFu.Types | |
Eq Bounds Source # | |
Ord Bounds Source # | |
type Rep Bounds Source # | |
Defined in Test.DejaFu.Types type Rep Bounds = D1 ('MetaData "Bounds" "Test.DejaFu.Types" "dejafu-2.4.0.5-G4EEj1kXZBX5wEYbPUnAst" 'False) (C1 ('MetaCons "Bounds" 'PrefixI 'True) (S1 ('MetaSel ('Just "boundPreemp") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe PreemptionBound)) :*: S1 ('MetaSel ('Just "boundFair") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe FairBound)))) |
newtype PreemptionBound Source #
Restrict the number of pre-emptive context switches allowed in an execution.
A pre-emption bound of zero disables pre-emptions entirely.
Since: 0.2.0.0
Instances
Restrict the maximum difference between the number of yield or delay operations different threads have performed.
A fair bound of zero disables yields and delays entirely.
Since: 0.2.0.0
Instances
Enum FairBound Source # | |
Defined in Test.DejaFu.Types succ :: FairBound -> FairBound # pred :: FairBound -> FairBound # fromEnum :: FairBound -> Int # enumFrom :: FairBound -> [FairBound] # enumFromThen :: FairBound -> FairBound -> [FairBound] # enumFromTo :: FairBound -> FairBound -> [FairBound] # enumFromThenTo :: FairBound -> FairBound -> FairBound -> [FairBound] # | |
Generic FairBound Source # | |
Num FairBound Source # | |
Read FairBound Source # | |
Integral FairBound Source # | |
Defined in Test.DejaFu.Types | |
Real FairBound Source # | |
Defined in Test.DejaFu.Types toRational :: FairBound -> Rational # | |
Show FairBound Source # | |
NFData FairBound Source # | Since: 0.5.1.0 |
Defined in Test.DejaFu.Types | |
Eq FairBound Source # | |
Ord FairBound Source # | |
Defined in Test.DejaFu.Types | |
type Rep FairBound Source # | Since: 1.3.1.0 |
Defined in Test.DejaFu.Types |
newtype LengthBound Source #
Restrict the maximum length (in terms of primitive actions) of an execution.
A length bound of zero immediately aborts the execution.
Since: 0.2.0.0
Instances
Discarding results and traces
An Either Condition a -> Maybe Discard
value can be used to
selectively discard results.
Since: 0.7.1.0
DiscardTrace | Discard the trace but keep the result. The result will appear to have an empty trace. |
DiscardResultAndTrace | Discard the result and the trace. It will simply not be reported as a possible behaviour of the program. |
Instances
Bounded Discard Source # | |
Enum Discard Source # | |
Generic Discard Source # | |
Read Discard Source # | |
Show Discard Source # | |
NFData Discard Source # | |
Defined in Test.DejaFu.Types | |
Eq Discard Source # | |
Ord Discard Source # | |
type Rep Discard Source # | Since: 1.3.1.0 |
A monoid for discard functions: combines two functions, keeping the weaker.
Nothing
is weaker than Just DiscardTrace
, which is weaker than
Just DiscardResultAndTrace
. This forms a commutative monoid
where the unit is const (Just DiscardResultAndTrace)
.
Since: 1.5.1.0
weakenDiscard :: (Either Condition a -> Maybe Discard) -> (Either Condition a -> Maybe Discard) -> Either Condition a -> Maybe Discard Source #
Combine two discard functions, keeping the weaker.
Since: 1.0.0.0
newtype Strengthen a Source #
A monoid for discard functions: combines two functions, keeping the stronger.
Just DiscardResultAndTrace
is stronger than Just DiscardTrace
,
which is stronger than Nothing
. This forms a commutative monoid
where the unit is const Nothing
.
Since: 1.5.1.0
Instances
Contravariant Strengthen Source # | |
Defined in Test.DejaFu.Types contramap :: (a' -> a) -> Strengthen a -> Strengthen a' # (>$) :: b -> Strengthen b -> Strengthen a # | |
Divisible Strengthen Source # | |
Defined in Test.DejaFu.Types divide :: (a -> (b, c)) -> Strengthen b -> Strengthen c -> Strengthen a # conquer :: Strengthen a # | |
Monoid (Strengthen a) Source # | |
Defined in Test.DejaFu.Types mempty :: Strengthen a # mappend :: Strengthen a -> Strengthen a -> Strengthen a # mconcat :: [Strengthen a] -> Strengthen a # | |
Semigroup (Strengthen a) Source # | |
Defined in Test.DejaFu.Types (<>) :: Strengthen a -> Strengthen a -> Strengthen a # sconcat :: NonEmpty (Strengthen a) -> Strengthen a # stimes :: Integral b => b -> Strengthen a -> Strengthen a # |
strengthenDiscard :: (Either Condition a -> Maybe Discard) -> (Either Condition a -> Maybe Discard) -> Either Condition a -> Maybe Discard Source #
Combine two discard functions, keeping the stronger.
Since: 1.0.0.0
Memory Models
The memory model to use for non-synchronised IORef
operations.
Since: 0.4.0.0
SequentialConsistency | The most intuitive model: a program behaves as a simple
interleaving of the actions in different threads. When a |
TotalStoreOrder | Each thread has a write buffer. A thread sees its writes immediately, but other threads will only see writes when they are committed, which may happen later. Writes are committed in the same order that they are created. |
PartialStoreOrder | Each |
Instances
Bounded MemType Source # | |
Enum MemType Source # | |
Generic MemType Source # | |
Read MemType Source # | |
Show MemType Source # | |
NFData MemType Source # | Since: 0.5.1.0 |
Defined in Test.DejaFu.Types | |
Eq MemType Source # | |
Ord MemType Source # | |
type Rep MemType Source # | Since: 1.3.1.0 |
Defined in Test.DejaFu.Types type Rep MemType = D1 ('MetaData "MemType" "Test.DejaFu.Types" "dejafu-2.4.0.5-G4EEj1kXZBX5wEYbPUnAst" 'False) (C1 ('MetaCons "SequentialConsistency" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TotalStoreOrder" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PartialStoreOrder" 'PrefixI 'False) (U1 :: Type -> Type))) |
MonadFail
newtype MonadFailException Source #
An exception for errors in testing caused by use of fail
.
Instances
Exception MonadFailException Source # | |
Defined in Test.DejaFu.Types | |
Generic MonadFailException Source # | |
Defined in Test.DejaFu.Types type Rep MonadFailException :: Type -> Type # from :: MonadFailException -> Rep MonadFailException x # to :: Rep MonadFailException x -> MonadFailException # | |
Show MonadFailException Source # | |
Defined in Test.DejaFu.Types showsPrec :: Int -> MonadFailException -> ShowS # show :: MonadFailException -> String # showList :: [MonadFailException] -> ShowS # | |
NFData MonadFailException Source # | Since: 1.3.1.0 |
Defined in Test.DejaFu.Types rnf :: MonadFailException -> () # | |
type Rep MonadFailException Source # | Since: 1.3.1.0 |
Defined in Test.DejaFu.Types type Rep MonadFailException = D1 ('MetaData "MonadFailException" "Test.DejaFu.Types" "dejafu-2.4.0.5-G4EEj1kXZBX5wEYbPUnAst" 'True) (C1 ('MetaCons "MonadFailException" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) |
Concurrency state
data ConcurrencyState Source #
A summary of the concurrency state of the program.
Since: 2.0.0.0
ConcurrencyState | |
|
Instances
Show ConcurrencyState Source # | |
Defined in Test.DejaFu.Types showsPrec :: Int -> ConcurrencyState -> ShowS # show :: ConcurrencyState -> String # showList :: [ConcurrencyState] -> ShowS # | |
NFData ConcurrencyState Source # | |
Defined in Test.DejaFu.Types rnf :: ConcurrencyState -> () # | |
Eq ConcurrencyState Source # | |
Defined in Test.DejaFu.Types (==) :: ConcurrencyState -> ConcurrencyState -> Bool # (/=) :: ConcurrencyState -> ConcurrencyState -> Bool # |
isBuffered :: ConcurrencyState -> IORefId -> Bool Source #
Check if a IORef
has a buffered write pending.
Since: 2.0.0.0
numBuffered :: ConcurrencyState -> IORefId -> Int Source #
Check how many buffered writes an IORef
has.
Since: 2.0.0.0
canInterrupt :: ConcurrencyState -> ThreadId -> ThreadAction -> Bool Source #
Check if an exception can interrupt a thread (action).
Since: 2.0.0.0
canInterruptL :: ConcurrencyState -> ThreadId -> Lookahead -> Bool Source #
Check if an exception can interrupt a thread (lookahead).
Since: 2.0.0.0
isMaskedInterruptible :: ConcurrencyState -> ThreadId -> Bool Source #
Check if a thread is masked interruptible.
Since: 2.0.0.0
isMaskedUninterruptible :: ConcurrencyState -> ThreadId -> Bool Source #
Check if a thread is masked uninterruptible.
Since: 2.0.0.0