Cholla 3.0.1-dev
Cholla - Massively parallel hydro on GPUs
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
shared.h File Reference
#include <atomic>
#include <cstddef>
#include <type_traits>
Include dependency graph for shared.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  detail::ControlBlock
 Helps implement SharedHandle & SharedDevPtr. More...
 
class  detail::ControlBlockImpl< HandleOrPtrType, Deleter >
 
class  SharedHandle< HandleT >
 Wraps a handles while providing shared object semantics. More...
 
class  SharedDevPtr< T >
 Wraps a device pointer while providing shared object semantics. More...
 

Macros

#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.
 

Typedefs

using detail::RefCountType = std::atomic< long >
 

Functions

long detail::ref_count_increment (RefCountType &count) noexcept
 
long detail::ref_count_decrement (RefCountType &count) noexcept
 

Detailed Description

declare SharedHandle and SharedDevPtr

Macro Definition Documentation

◆ 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
KLASSThe name of the class template (i.e. SharedHandle or SharedDevPtr)

Function Documentation

◆ 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)