fvars: Fast Mutable Vars

[ bsd3, data, library ] [ Propose Tags ]

Fast single writer, multiple reader Vars


[Skip to Readme]
Versions [faq] 1.0.0.0
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 Sun Sep 22 11:00:26 UTC 2019
Distributions NixOS:1.0.0.0
Downloads 48 total (48 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-09-22 [all 1 reports]

Modules

[Index] [Quick Jump]

Flags

NameDescriptionDefaultType
debug

Enable debug messages

DisabledManual

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

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


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.