#include <atomic>
#include <cstddef>
#include <type_traits>
Go to the source code of this file.
|
|
#define | CALL_INCREMENT_COUNT(cb_ptr) (cb_ptr)->increment_count() |
| |
|
#define | CALL_DECREMENT_COUNT(cb_ptr) (cb_ptr)->decrement_count() |
| |
| #define | DEFINE_COMMON_METHODS(KLASS) |
| | Implements common methods of SharedHandle and SharedDevPtr.
|
| |
|
|
using | detail::RefCountType = std::atomic< long > |
| |
◆ DEFINE_COMMON_METHODS
| #define DEFINE_COMMON_METHODS |
( |
|
KLASS | ) |
|
Implements common methods of SharedHandle and SharedDevPtr.
This macro exists due to the intrinsic similarity between SharedHandle and SharedDevPtr: a handle and a pointer are different ways to represent a to a resource. Thus, this macro provides definitions for methods that have the same structure in both class templates without repeating ourselves.
- Parameters
-
◆ ref_count_decrement()
| long detail::ref_count_decrement |
( |
RefCountType & |
count | ) |
|
|
inlinenoexcept |
atomically decrement the reference count (return the old value)
◆ ref_count_increment()
| long detail::ref_count_increment |
( |
RefCountType & |
count | ) |
|
|
inlinenoexcept |
atomically increment the reference count (return the old value)