|
Control.Concurrent.Priority.Room |
|
|
|
Synopsis |
|
|
|
Documentation |
|
|
A resource pool, parameterized against arbitrary user data.
| Instances | |
|
|
|
Create a new Room with some arbitrary user data.
|
|
|
Get all ThreadIds that are currently claimimg this Room.
|
|
|
A Claim, or attempt to acquire or release a Room.
|
|
|
|
Get the Room target of a Claim.
|
|
|
Get the thread attempting a Claim.
|
|
|
Get the user data associated with a Room.
|
|
type family UserData u :: * | Source |
|
|
|
| Methods | | | Instances | |
|
|
class RoomConstraint u where | Source |
|
| Methods | | Should either approve or retry each claim.
|
| | Instances | |
|
|
class BaseRoomContext c where | Source |
|
Rules for calling claim_. The two major contexts are DefaultRoomContext, which uses RoomConstraints to
determine which Rooms are available, and UnconstrainedRoomContext, which does not place any constraints on any Room.
| | Associated Types | type BaseRoomContextData c :: * | Source |
|
| | Methods | | Should approve a some claims before entering a critical section, as described by claim_.
| | | Should approve a some claims before exiting a critical section, as described by claim_.
| | | A waiting transaction, as described by claim_.
|
| | Instances | |
|
|
class RoomContext c where | Source |
|
An indirect reference to a BaseRoomContext.
| | Associated Types | | | Methods | | | Instances | |
|
|
|
A maximum limit on the number of threads allowed to claim a room.
| Constructors | | Instances | |
|
|
|
Constructors | | Instances | |
|
|
data DefaultRoomContext u | Source |
|
Require that all RoomConstraints be satisfied when acquiring a Room. This is the default.
| Constructors | | Instances | |
|
|
data UnconstrainedRoomContext u | Source |
|
|
|
|
Temporarily Acquire, and then release, or Release, and then acquire, some Rooms for the duration of a critical section.
A simple example where a room might be used to prevent interleaving of stdout:
room <- newRoom (MaxThreads 1)
forkIO $ claim Acquire room $ putStrLn "Hello World!"
forkIO $ claim Acquire room $ putStrLn "Foo! Bar!"
|
|
|
approve some claims according to their constraints.
|
|
Produced by Haddock version 2.4.2 |