tbox-0.1.0: Transactional variables and data structures with IO hooks

Portabilitynon-portable (requires STM)
Stabilityexperimental
MaintainerPeter Robinson <thaldyron@gmail.com>

Control.Concurrent.TBox.Internal.Operations

Description

Operations on instances of TBox.

Synopsis

Documentation

clear :: TBox t k a => t k a -> AdvSTM ()Source

Deletes the content.

write :: TBox t k a => t k a -> a -> AdvSTM ()Source

Writes the new content.

read :: TBox t k a => t k a -> AdvSTM (Maybe a)Source

If the TBox is dirty, this retries the transaction and rereads the content using readIO in a separate thread. Otherwise it simply returns the result of readSTM.

Note: Depending on the instance implementation, careless use of setDirty and read in the same transaction might lead to nonterminating retry loops.

isEmpty :: TBox t k a => t k a -> AdvSTM BoolSource

Returns True iff the TBox is empty.

isEmptyNotDirty :: TBox t k a => t k a -> AdvSTM BoolSource

Returns True iff the TBox is empty and not dirty.