broadcast-chan-0.2.1.2: broadcast-chan.cabal
Cabal-Version: 2.2
Name: broadcast-chan
Version: 0.2.1.2
Homepage: https://github.com/merijn/broadcast-chan
Bug-Reports: https://github.com/merijn/broadcast-chan/issues
Author: Merijn Verstraaten
Maintainer: Merijn Verstraaten <merijn@inconsistent.nl>
Copyright: Copyright © 2014-2021 Merijn Verstraaten
License: BSD-3-Clause
License-File: LICENSE
Category: System
Build-Type: Simple
Tested-With: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5,
GHC == 8.8.4, GHC == 8.10.7, GHC == 9.0.1, GHC == 9.2.1
Extra-Source-Files: README.md
, CHANGELOG.md
Synopsis: Closable, fair, single-wakeup channel type that avoids 0
reader space leaks.
Description:
__WARNING:__ While the code in this library should be fairly stable and
production, the API is something I'm still working on. API changes will
follow the PVP, but __expect__ breaking API changes in future versions!
.
A closable, fair, single-wakeup channel that avoids the 0 reader space leak
that @"Control.Concurrent.Chan"@ from base suffers from.
.
The @Chan@ type from @"Control.Concurrent.Chan"@ consists of both a read
and write end combined into a single value. This means there is always at
least 1 read end for a @Chan@, which keeps any values written to it alive.
This is a problem for applications/libraries that want to have a channel
that can have zero listeners.
.
Suppose we have an library that produces events and we want to let users
register to receive events. If we use a channel and write all events to it,
we would like to drop and garbage collect any events that take place when
there are 0 listeners. The always present read end of @Chan@ from base
makes this impossible. We end up with a @Chan@ that forever accumulates
more and more events that will never get removed, resulting in a memory
leak.
.
@"BroadcastChan"@ splits channels into separate read and write ends. Any
message written to a a channel with no existing read end is immediately
dropped so it can be garbage collected. Once a read end is created, all
messages written to the channel will be accessible to that read end.
.
Once all read ends for a channel have disappeared and been garbage
collected, the channel will return to dropping messages as soon as they are
written.
.
__Why should I use "BroadcastChan" over "Control.Concurrent.Chan"?__
.
* @"BroadcastChan"@ is closable,
.
* @"BroadcastChan"@ has no 0 reader space leak,
.
* @"BroadcastChan"@ has comparable or better performance.
.
__Why should I use "BroadcastChan" over various (closable) STM channels?__
.
* @"BroadcastChan"@ is single-wakeup,
.
* @"BroadcastChan"@ is fair,
.
* @"BroadcastChan"@ performs better under contention.
Flag sync
Description: Benchmarks synchronisation primitives used in main
benchmark.
Default: False
Manual: True
Flag threaded
Description: Run benchmarks with threaded backend.
Default: True
Manual: True
Library
Default-Language: Haskell2010
GHC-Options: -Wall -O2 -Wno-unused-do-bind
Exposed-Modules: BroadcastChan
BroadcastChan.Extra
BroadcastChan.Prelude
BroadcastChan.Throw
Other-Modules: BroadcastChan.Internal
Other-Extensions: DataKinds
DeriveDataTypeable
KindSignatures
NamedFieldPuns
Safe
ScopedTypeVariables
Trustworthy
TupleSections
Build-Depends: base >= 4.8 && < 4.17
, transformers >= 0.2 && < 0.7
, unliftio-core >= 0.1.1 && < 0.3
Common concurrent-benchmarks
Default-Language: Haskell2010
GHC-Options: -Wall -O2 -Wno-orphans -rtsopts
if flag(threaded)
GHC-Options: -threaded -with-rtsopts=-qg
Hs-Source-Dirs: benchmarks
Other-Extensions: BangPatterns
Build-Depends: base
, async >= 2.0 && < 2.3
, criterion >= 1.2 && < 1.6
, deepseq >= 1.1 && < 1.5
, stm >= 2.4 && < 2.6
Benchmark sync
Import: concurrent-benchmarks
Type: exitcode-stdio-1.0
Main-Is: Sync.hs
if flag(sync)
Buildable: True
else
Buildable: False
Build-Depends: atomic-primops == 0.8.*
Benchmark channels
Import: concurrent-benchmarks
Type: exitcode-stdio-1.0
Main-Is: Channels.hs
GHC-Options: -Wno-unused-do-bind -Wno-type-defaults
Other-Extensions: DeriveGeneric
RecordWildCards
Build-Depends: broadcast-chan
Benchmark utilities
Default-Language: Haskell2010
Type: exitcode-stdio-1.0
Main-Is: Utils.hs
GHC-Options: -Wall -O2 -Wno-orphans -Wno-unused-do-bind
-rtsopts
if flag(threaded)
GHC-Options: -threaded -with-rtsopts=-qg
Hs-Source-Dirs: benchmarks
Build-Depends: base
, broadcast-chan
Source-Repository head
Type: git
Location: ssh://github.com:merijn/broadcast-chan.git