|
Cholla 3.0.1-dev
Cholla - Massively parallel hydro on GPUs
|
Wraps a handles while providing shared object semantics. More...
#include <shared.h>
Public Types | |
| typedef HandleT | wrapped_ref_type |
Public Member Functions | |
| __host__ __device__ | SharedHandle () |
| Default Constructor (constructs an empty instance) | |
| template<typename Deleter > | |
| __host__ | SharedHandle (HandleT handle, Deleter d) |
| Primary constructor. | |
| __host__ __device__ | ~SharedHandle () noexcept |
| Destructor. | |
| __host__ __device__ | SharedHandle (const SharedHandle &other) noexcept |
| __host__ __device__ | SharedHandle (SharedHandle &&other) noexcept |
| __host__ __device__ SharedHandle & | operator= (const SharedHandle &other) noexcept |
| __host__ __device__ SharedHandle & | operator= (SharedHandle &&other) noexcept |
| __host__ __device__ void | swap (SharedHandle &o) noexcept |
| swap the contents of this and other | |
| __host__ __device__ void | reset () noexcept |
| Release ownership of the owned resource (if any) | |
| __host__ __device__ __forceinline__ HandleT | get () const noexcept |
| Return the stored handle. | |
| __host__ __device__ | operator bool () const noexcept |
returns false if this is empty | |
Wraps a handles while providing shared object semantics.
At a high level this analogous to shared_ptr, but for handles.
This type primarily exists in order to wrap the cudaTextureObject_t handle.
|
inline |
Default Constructor (constructs an empty instance)
|
inline |
Primary constructor.
d is a callback function-like object that is used deallocate handle when all SharedHandle instances that wrap handle release ownership. The callback will be invoked as d(handle)
| handle | the handle to be managed by the constructed instance |
| d | A deleter instance used to destroy the handle |
handle that is already owned by another SharedHandle leads to undefined behavior
|
noexcept |
Release ownership of the owned resource (if any)
This is equivalent to SharedHandle().swap(*this);