Crate audio_garbage_collector
source ·Expand description
Batteries included solution to using reference counted values on the audio-thread.
Wraps basedrop
so that smart pointers are dropped on a background thread. Exposes a default
global GC thread and helpers to create pointers attached to it.
Collection frequency
Collection is based on polling the queue every 100ms by default.
If references are created and dropped very frequently this strategy is not adequate. This also adds some small overhead.
Structs
- Wraps
basedrop::Collector
with a polling GC thread. - An owned smart pointer with deferred collection, analogous to
Box
. - A reference-counted smart pointer with deferred collection, analogous to
Arc
. - A thread-safe shared mutable memory location that holds a
Shared<T>
.
Enums
- Errors that may be emitted when stopping the GC
Functions
- Return a reference to a global GC instance
- Return a handle to a global GC instance
- Create a new
basedrop::Shared
value using the default globalGarbageCollector
instance. - Create a new
basedrop::SharedCell
value using the default globalGarbageCollector
instance.