Copyright | (c) Alex Semin, 2015 |
---|---|
License | BSD3 |
Maintainer | alllex.semin@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Data structure which is used as a helper to build more advanced
Class
implementations. It employs work-stealing in
a Round Robin manner.
- data RoundRobinBag v
- build :: Bag b => STM (b v) -> STM (RoundRobinBag v)
- add :: RoundRobinBag v -> v -> STM ()
- take :: RoundRobinBag v -> STM v
- isEmpty :: RoundRobinBag v -> STM Bool
Documentation
data RoundRobinBag v Source
build :: Bag b => STM (b v) -> STM (RoundRobinBag v) Source
Given an Class
implementation
creates an array of capability-local data structures
of length matching the amount of available capabilities.
add :: RoundRobinBag v -> v -> STM () Source
O(1). Adding always to capability-local bag.
take :: RoundRobinBag v -> STM v Source
O(1). Removing an item from capability-local bag. In case the local bag is empty tries to remove item from another bag.
isEmpty :: RoundRobinBag v -> STM Bool Source
O(1). Checks whether the bag is empty by traversing through capability-local bags.