Sunshine0.0.5917
Sunshine 0.0.5917
Self-hosted game stream host for Moonlight.
Loading...
Searching...
No Matches
safe::shared_t< T > Class Template Reference

Shared object storage with custom construction and destruction hooks. More...

#include <src/thread_safe.h>

Classes

struct  ptr_t
 Pointer wrapper state protected by synchronization. More...

Public Types

using construct_f = std::function<int(element_type &)>
 Callback signature used to construct the protected object.
using destruct_f = std::function<void(element_type &)>
 Callback signature used to destroy the protected object.
using element_type = T
 Object type stored in shared protected storage.

Public Member Functions

ptr_t ref ()
 Return a shared reference to the protected object.
template<class FC, class FD>
 shared_t (FC &&fc, FD &&fd)
 Construct a shared protected object with custom close and destruction hooks.

Detailed Description

template<class T>
class safe::shared_t< T >

Shared object storage with custom construction and destruction hooks.

Constructor & Destructor Documentation

◆ shared_t()

template<class T>
template<class FC, class FD>
safe::shared_t< T >::shared_t ( FC && fc,
FD && fd )
inline

Construct a shared protected object with custom close and destruction hooks.

Parameters
fcCallable invoked when the shared object is closed.
fdCallable invoked when the shared object is destroyed.

Member Function Documentation

◆ ref()

template<class T>
ptr_t safe::shared_t< T >::ref ( )
inlinenodiscard

Return a shared reference to the protected object.

Returns
Reference handle that keeps the protected object alive.

The documentation for this class was generated from the following file: