columbia-0.1.2: Enhanced serialization for media that support seeking.

Safe HaskellSafe
LanguageHaskell98

Data.Columbia.DualLock

Description

A dual lock can be taken in either exclusive or shared mode, and also supports switching (atomically) from one mode to the other.

Synopsis

Documentation

switchLocks :: DualLockShared -> IO DualLock Source #

N.B. That two simultaneous attempts to switch locks will deadlock. Please protect a critical section that switches locks with some other lock, to ensure this doesn't happen. For instance, the garbage collector protects its use of switchLocks on a dual lock, with an exclusive writer lock.

switchLocks2 :: DualLock -> IO DualLockShared Source #

Switching from an exclusive to a shared lock may be done at any time.