rcu-0.1: Read-Copy-Update for Haskell

Copyright(C) 2015 Edward Kmett and Ted Cooper
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com> Ted Cooper <anthezium@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellTrustworthy
LanguageHaskell2010

Control.Concurrent.RCU.QSBR

Contents

Description

Quiescent-State-Based Reclamation

Synopsis

Documentation

data RCU s a Source

This is an RCU computation. It can use forking and joining to form new threads, and then you can use reading and writing to run classic read-side and write-side RCU computations. Writers are serialized using an MVar, readers are able to proceed while writers are updating.

runRCU :: (forall s. RCU s a) -> IO a Source

Run an RCU computation.

class Monad m => MonadNew s m | m -> s where Source

Minimal complete definition

Nothing

Methods

newSRef :: a -> m (s a) Source

Build a new shared reference

Instances

MonadNew s m => MonadNew s (IdentityT m) Source 
MonadNew s m => MonadNew s (MaybeT m) Source 
MonadNew s m => MonadNew s (ExceptT e m) Source 
MonadNew s' m => MonadNew s' (StateT s m) Source 
MonadNew s' m => MonadNew s' (StateT s m) Source 
(MonadNew s m, Monoid w) => MonadNew s (WriterT w m) Source 
(MonadNew s m, Monoid w) => MonadNew s (WriterT w m) Source 
MonadNew s m => MonadNew s (ReaderT e m) Source 
(MonadNew s' m, Monoid w) => MonadNew s' (RWST r w s m) Source 
(MonadNew s' m, Monoid w) => MonadNew s' (RWST r w s m) Source 
MonadNew (SRef s) (RCU s) Source 
MonadNew (SRef s) (WritingRCU s) Source 
MonadNew (SRef s) (ReadingRCU s) Source 

class MonadNew s m => MonadReading s m | m -> s where Source

This is a read-side critical section

Minimal complete definition

Nothing

Methods

readSRef :: s a -> m a Source

Read a shared reference.

class MonadReading s m => MonadWriting s m | m -> s where Source

This is a write-side critical section

Minimal complete definition

Nothing

Methods

writeSRef :: s a -> a -> m () Source

Write to a shared reference.

synchronize :: m () Source

Synchronize with other writers.

No other writer can straddle this time bound. It will either see writes from before, or writes after, but never some of both!

class (MonadReading s (Reading m), MonadWriting s (Writing m), MonadNew s m) => MonadRCU s m | m -> s where Source

This is the executor service that can fork, join and execute critical sections.

Associated Types

type Reading m :: * -> * Source

A read-side critical section

type Writing m :: * -> * Source

A write-side critical section

type Thread m :: * -> * Source

Threads we can fork and join

Methods

forking :: m a -> m (Thread m a) Source

Fork a thread

joining :: Thread m a -> m a Source

Join a thread

reading :: Reading m a -> m a Source

Run a read-side critical section

writing :: Writing m a -> m a Source

Run a write-side critical section

Instances

MonadRCU s m => MonadRCU s (MaybeT m) Source 
MonadRCU s m => MonadRCU s (IdentityT m) Source 
(MonadRCU s m, Monoid e) => MonadRCU s (WriterT e m) Source 
(MonadRCU s m, Monoid e) => MonadRCU s (WriterT e m) Source 
MonadRCU s m => MonadRCU s (ExceptT e m) Source 
MonadRCU s m => MonadRCU s (ReaderT e m) Source 
MonadRCU (SRef s) (RCU s) Source 

Implementation Details

data ReadingRCU s a Source

This is the basic read-side critical section for an RCU computation

data WritingRCU s a Source

This is the basic write-side critical section for an RCU computation

data RCUThread s a Source

This is a basic RCU thread. It may be embellished when running in a more exotic context.