SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Sleak::SharedControlBlock Struct Reference

#include <RefPtr.hpp>

Public Member Functions

 SharedControlBlock ()

Public Attributes

std::atomic< size_t > refCount
 Number of RefPtr instances currently owning the object.

Detailed Description

Reference count shared by every RefPtr aimed at one object.

Allocated separately from the object, and non-templated so that a RefPtr<Base> converted from a RefPtr<Derived> shares the same count. The counter is atomic, so copying and destroying RefPtrs across threads is safe; the pointed-to object still needs its own synchronization.

See also
RefPtr

Definition at line 18 of file RefPtr.hpp.

Constructor & Destructor Documentation

◆ SharedControlBlock()

Sleak::SharedControlBlock::SharedControlBlock ( )
inline

Definition at line 21 of file RefPtr.hpp.

Member Data Documentation

◆ refCount

std::atomic<size_t> Sleak::SharedControlBlock::refCount

Number of RefPtr instances currently owning the object.

Definition at line 20 of file RefPtr.hpp.