fvars: Fast Mutable Vars

[ bsd3, data, library ] [ Propose Tags ]

Fast single writer, multiple reader Vars

[Skip to Readme]
Versions [faq]
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), exceptions (==0.10.*), monad-control (==1.0.*), 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 NixOS:
Downloads 349 total (3 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-09-22 [all 1 reports]


[Index] [Quick Jump]



Enable debug messages


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


Maintainer's Corner

For package maintainers and hackage trustees

Readme for fvars-

[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.