lifetimes-0.2.0.1: Flexible manual resource management
Safe HaskellSafe-Inferred
LanguageHaskell2010

Lifetimes.Rc

Description

Rather than associating a resource with one lifetime, a reference counted resource associates each *reference* with a lifetime, and is released when all references have expired.

Synopsis

Documentation

data Rc a Source #

A resource which is managed by reference counting.

addRef :: Rc a -> Acquire a Source #

Acquire a new reference.

refCounted :: Acquire a -> Acquire (Rc a) Source #

Acquire a resource using refcounting. Takes an Acquire for the underlying resource, and returns one that acquires an initial reference to it. Additional references may be created using addRef, and the underlying resource will be kept alive until all resources are released.