fvars: Fast Mutable Vars

[ bsd3, data, library ] [ Propose Tags ]

Fast single writer, multiple reader Vars


[Skip to Readme]

Modules

[Index] [Quick Jump]

Flags

Manual Flags

NameDescriptionDefault
debug

Enable debug messages

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.0.0.0
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), exceptions (>=0.10 && <0.11), monad-control (>=1.0 && <1.1), mtl (>=2.2.2 && <2.3), transformers (>=0.5.5 && <0.6) [details]
License BSD-3-Clause
Copyright 2019 Erick Gonzalez
Author Erick Gonzalez <erick@codemonkeylabs.de>
Maintainer erick@codemonkeylabs.de
Category Data
Home page https://gitlab.com/codemonkeylabs/fvars#readme
Bug tracker https://github.com/codemonkeylabs/fvars/issues
Source repo head: git clone https://gitlab.com/codemonkeylabs/fvars
Uploaded by erick at 2019-09-22T11:00:26Z
Distributions
Downloads 521 total (9 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2019-09-22 [all 1 reports]

Readme for fvars-1.0.0.0

[back to package description]

FVar - Fast Vars for Haskell

This library implements an "FVar" or fast Var. The idea is that it allows concurrent readers to access shared data without locking, but the moment a writer performs a write it gets exclusive access to the var. If there are readers currently accesing the data, it waits until they complete the operation, blocks any further reads and then it performs the write. Once it is done, it reenables the stalled readers and lockless operation continues.

The implementation favours reads above writes. When reads are stalled to service a write, all read operations stalled waiting for the write to complete are allowed to be performed right after the one write is completed, regardless of whether there might be other writes already waiting. After those pending reads are finished, another write will be allowed and thus new read requests will be blocked etc. This means the FVar lock is better suited for applications where data is read by multiple threads often but seldom written to.