rwlock-0.0.0.2: Multiple-read / single-write locks

Control.Concurrent.RWLock

Description

A simple implementation of a multiple-reader / single-writer lock, using Control.Concurrent.STM.

Synopsis

Documentation

data RWLockState Source

A type representing the state of a lock: available, in use by a certain number of readers, or in use by a writer.

Constructors

Open 
Readers Int 
Writing 

withReadLock :: RWLock -> IO a -> IO aSource

Acquire a lock in read mode, try to execute some action, and release the lock.

withWriteLock :: RWLock -> IO a -> IO aSource

Acquire a lock in write mode, try to execute some action, and release the lock.