mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-09 04:54:15 +01:00
36 lines
528 B
C
36 lines
528 B
C
|
#pragma once
|
||
|
|
||
|
#include <atomic>
|
||
|
|
||
|
namespace dxvk {
|
||
|
|
||
|
/**
|
||
|
* \brief Reference-counted object
|
||
|
*/
|
||
|
class RcObject {
|
||
|
|
||
|
public:
|
||
|
|
||
|
/**
|
||
|
* \brief Increments reference count
|
||
|
* \returns New reference count
|
||
|
*/
|
||
|
uint32_t incRef() {
|
||
|
return ++m_refCount;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* \brief Decrements reference count
|
||
|
* \returns New reference count
|
||
|
*/
|
||
|
uint32_t decRef() {
|
||
|
return --m_refCount;
|
||
|
}
|
||
|
|
||
|
private:
|
||
|
|
||
|
std::atomic<uint32_t> m_refCount = { 0u };
|
||
|
|
||
|
};
|
||
|
|
||
|
}
|