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

Copyright (c) 2016--2018 Michael Walker MIT Michael Walker experimental portable None Haskell2010

Test.DejaFu.Schedule

Description

Scheduling for concurrent computations.

Synopsis

# Scheduling

newtype Scheduler state Source #

A Scheduler drives the execution of a concurrent program. The parameters it takes are:

1. The last thread executed (if this is the first invocation, this is Nothing).
3. The concurrency state.
4. The scheduler state.

It returns a thread to execute, or Nothing if execution should abort here, and also a new state.

Since: 2.0.0.0

Constructors

## Preemptive

A simple random scheduler which, at every step, picks a random thread to run.

Since: 0.8.0.0

A round-robin scheduler which, at every step, schedules the thread with the next ThreadId.

Since: 0.8.0.0

## Non-preemptive

A random scheduler which doesn't preempt the running thread. That is, if the previously scheduled thread is not blocked, it is picked again, otherwise schedule randomly.

Since: 0.8.0.0

A round-robin scheduler which doesn't preempt the running thread. That is, if the previously scheduled thread is not blocked, it is picked again, otherwise schedule the thread with the next ThreadId.

Since: 0.8.0.0

# Utilities

Turn a potentially preemptive scheduler into a non-preemptive one.

Since: 0.8.0.0