Safe Haskell | None |
---|---|
Language | Haskell98 |
Documentation
A binary switch that is off unless held on during the execution of some IO process. The state of a latch can be read at any time, but can be held on by at most one thread at a time.
withLatchOn :: Latch -> IO a -> IO a Source #
Flips the latch on, executes the action, and finally flips the latch off again (even if the action throws an exception). A latch may be held on by at most one thread at a time. If a second thread tries to turn the latch on, it will block.