| Copyright | (c) Sergey Vinokurov 2022 |
|---|---|
| License | Apache-2.0 (see LICENSE) |
| Maintainer | serg.foo@gmail.com |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Control.Concurrent.Counter.Lifted.IO
Documentation
Memory location that supports select few atomic operations.
Isomorphic to IORef Int.
Create
Read/write
Arithmetic operations
add :: Counter -> Int -> IO Int Source #
Atomically add an amount to the counter and return its old value.
sub :: Counter -> Int -> IO Int Source #
Atomically subtract an amount from the counter and return its old value.
Bitwise operations
and :: Counter -> Int -> IO Int Source #
Atomically combine old value with a new one via bitwise and. Returns old counter value.
or :: Counter -> Int -> IO Int Source #
Atomically combine old value with a new one via bitwise or. Returns old counter value.