Stability | experimental |
---|---|
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Safe Haskell | Safe-Infered |
Tested with: GHC 7.0.3
This module defines a limited resource which can be acquired and
then released by the discontinuous process Process
.
- data Resource
- newResource :: EventQueue -> Int -> Simulation Resource
- resourceQueue :: Resource -> EventQueue
- resourceInitCount :: Resource -> Int
- resourceCount :: Resource -> Dynamics Int
- requestResource :: Resource -> Process ()
- releaseResource :: Resource -> Process ()
Documentation
newResource :: EventQueue -> Int -> Simulation ResourceSource
Create a new resource with the specified initial count.
resourceQueue :: Resource -> EventQueueSource
Return the bound event queue.
resourceInitCount :: Resource -> IntSource
Return the initial count of the resource.
resourceCount :: Resource -> Dynamics IntSource
Return the current count of the resource.
requestResource :: Resource -> Process ()Source
Request for the resource decreasing its count in case of success, otherwise suspending the discontinuous process until some other process releases the resource.
releaseResource :: Resource -> Process ()Source
Release the resource increasing its count and resuming one of the previously suspended processes as possible.