|Maintainer||Bas van Dijk <email@example.com> , Roel van Dijk <firstname.lastname@example.org>|
This module provides an
STM version of
This module is intended to be imported qualified. We suggest importing it like:
import Control.Concurrent.STM.Lock ( Lock ) import qualified Control.Concurrent.STM.Lock as Lock ( ... )
Locking and unlocking
- When the state is "locked"
- When the state is "unlocked"
acquirewill change the state to "locked".
release changes the state to "unlocked" and returns immediately.
Note that it is an error to release a lock in the "unlocked" state!
A convenience function which first acquires the lock and then performs the computation. When the computation terminates, whether normally or by raising an exception, the lock is released.
tryWith is a convenience function which first tries to
acquire the lock. If that fails,
Nothing is returned. If it succeeds, the
computation is performed. When the computation terminates, whether normally or
by raising an exception, the lock is released and
Just the result of the
computation is returned.