| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Control.Concurrent.MVarLock
Description
Using an MVar () as a lock is a common pattern. This module just wraps that up
into some functions with nice names that make the pattern explicit.
Documentation
A lock that can be exclusively acquired with acquireLock.
acquireLock :: Lock -> IO () Source #
Block until the lock is available, then grab it. Something that acquires
the lock should at some point subsequently relinquish it with releaseLock.
Consider using withLock instead unless you need more fine-grained control.
releaseLock :: Lock -> IO () Source #
Release a lock that you have previously acquired with acquireLock.
withLock :: Lock -> IO a -> IO a Source #
Acquire the lock, perform some action while the lock is held, then
release the lock. You can use this instead of manually calling acquireLock
and releaseLock.