SEDNL  .
Simple Event Driven Network Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | List of all members
SedNL::SafeType< T > Class Template Reference

Allow to protect a type T with a mutex. More...

#include <ThreadHelp.hpp>

Public Member Functions

 SafeType (T v) noexcept
 Create an atomic T from a value v. More...
 
 operator T () const
 Conversion from SafeType<T> to T. More...
 
SafeType< T > & operator= (T v)
 Change the value stored. More...
 

Detailed Description

template<class T>
class SedNL::SafeType< T >

Allow to protect a type T with a mutex.

Definition at line 47 of file sednlfwd.hpp.

Constructor & Destructor Documentation

template<class T>
SedNL::SafeType< T >::SafeType ( v)
inlinenoexcept

Create an atomic T from a value v.

Parameters
[in]vInitial value.

Definition at line 31 of file ThreadHelp.ipp.

Member Function Documentation

template<class T >
SedNL::SafeType< T >::operator T ( ) const
inline

Conversion from SafeType<T> to T.

This operator use the internal mutex to allow using this object in a multithreaded environment.

Returns
The value stored.

Definition at line 37 of file ThreadHelp.ipp.

template<class T>
SafeType< T > & SedNL::SafeType< T >::operator= ( v)
inline

Change the value stored.

This operator use the internal mutex to allow using this object in a multithreaded environment.

Parameters
[in]vValue to store.
Returns
A reference to this.

Definition at line 44 of file ThreadHelp.ipp.


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