abstract-deque-0.3: Abstract, parameterized interface to mutable Deques.

Safe Haskell | Safe-Inferred
Language | Haskell98

Data.Concurrent.Deque.Debugger

Description

This module provides a wrapper around a deque that can enforce additional invariants at runtime for debugging purposes.

Synopsis

- data DebugDeque (d :: Type -> Type) elt = DebugDeque (IORef (Maybe ThreadId), IORef (Maybe ThreadId)) (d elt)

# Documentation

data DebugDeque (d :: Type -> Type) elt Source #

Warning, this enforces the excessively STRONG invariant that if any end of the deque is non-threadsafe then it may ever only be touched by one thread during its entire lifetime.

This extreme form of monagamy is easier to verify, because we don't have enough information to know if two operations on different threads are racing with one another or are properly synchronized.

The wrapper data structure has two IORefs to track the last thread that touched the left and right end of the deque, respectively.

Constructors

DebugDeque (IORef (Maybe ThreadId), IORef (Maybe ThreadId)) (d elt) |

#### Instances

Instances details

DequeClass d => DequeClass (DebugDeque d) Source # |
Instance details Defined in Data.Concurrent.Deque.Debugger Methods newQ :: IO (DebugDeque d elt) Source # nullQ :: DebugDeque d elt -> IO Bool Source # pushL :: DebugDeque d elt -> elt -> IO () Source # tryPopR :: DebugDeque d elt -> IO (Maybe elt) Source # leftThreadSafe :: DebugDeque d elt -> Bool Source # rightThreadSafe :: DebugDeque d elt -> Bool Source #
PopL d => PopL (DebugDeque d) Source # |
Instance details Defined in Data.Concurrent.Deque.Debugger Methods tryPopL :: DebugDeque d elt -> IO (Maybe elt) Source #