keid-core-0.1.6.1: Core parts of Keid engine.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Engine.Types.RefCounted

Synopsis

Documentation

data RefCounted Source #

A RefCounted will perform the specified action when the count reaches 0

Constructors

RefCounted 

Fields

newRefCounted :: MonadIO m => IO () -> m RefCounted Source #

Create a counter with a value of 1

releaseRefCounted :: MonadIO m => RefCounted -> m () Source #

Decrement the value, the action will be run promptly and in this thread if the counter reached 0.

takeRefCounted :: MonadIO m => RefCounted -> m () Source #

Increment the counter by 1

resourceTRefCount :: MonadResource f => RefCounted -> f () Source #

Hold a reference for the duration of the MonadResource action