stm-data-collection-0.1.0.0: Collection of STM-based Data Structures

Copyright(c) Alex Semin, 2015
LicenseBSD3
Maintaineralllex.semin@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.STM.Bag.Internal.RoundRobinBag

Description

Data structure which is used as a helper to build more advanced Class implementations. It employs work-stealing in a Round Robin manner.

Synopsis

Documentation

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.