5#include "slideio/core/slideio_core_def.hpp"
9 class SLIDEIO_CORE_EXPORTS RefCounter
12 void increaseCounter() {
13 if (m_counter.fetch_add(1, std::memory_order_acq_rel) == 0)
16 void decreaseCounter() {
17 if (m_counter.fetch_sub(1, std::memory_order_acq_rel) == 1)
21 virtual void initializeCounter(){};
22 virtual void cleanCounter(){};
24 std::atomic<int> m_counter{0};
27 class SLIDEIO_CORE_EXPORTS RefCounterGuard
30 RefCounterGuard(RefCounter* counter) : m_counter(counter) {
32 m_counter->increaseCounter();
36 m_counter->decreaseCounter();
38 RefCounter* m_counter;
Definition: exceptions.hpp:15