PriorityChansConverger: Read single output from an array of inputs - channels with priorities

[ concurrency, library ] [ Propose Tags ] [ Report a vulnerability ]

Abbreviation for the PriorityChansConverger is PCC.

Based on STM.TChan, extended with capacity control. Wrapped into IO version is also available.

When user reads from the PCC, the choice is made - from which channel to read. System selects a nonempty channel, whose (CurrentPriority, StartPriority) tuple is max. The side effect of the channel selection is it's CurrentPriority decrease by one, if it's value becomes less than one, then the CurrentPriority is set to StartPriority.

For the main API interface:

import Control.Concurrent.PriorityChansConverger

The realization probably isn't very fast and isn't good at memory economy, since it uses fresh high level primitive - STM. It wasn't intended to be used with millions of channels. But it's max throughput comparing to the ordinary Chan throughput is to be estimated (will do it in some future version).

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1
Dependencies base (>=4 && <5), containers, stm [details]
Tested with ghc ==6.10.4
License LicenseRef-LGPL
Copyright Copyright (c) 2009-2010 Andrejs Sisojevs
Author Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru>
Maintainer Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru>
Category Concurrency
Uploaded by AndreySisoyev at 2010-01-03T07:02:58Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1389 total (2 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]