Games Task Scheduler (GTS)
A multi-processor scheduling framework for games engines
gts::WriteGuard< T, TAccessorSharedMutex, TGrowSharedMutex > Class Template Reference

A read-write item guarded by a mutex. The mutex is released on destruction. More...

#include <Guards.h>

Inherits gts::internal::GuardBase< T, TAccessorSharedMutex, TGrowSharedMutex >.

Public Member Functions

 WriteGuard (WriteGuard const &)=delete
 
 WriteGuard (WriteGuard &&)=default
 
WriteGuardoperator= (WriteGuard const &)=delete
 
WriteGuardoperator= (WriteGuard &&)=default
 
 WriteGuard (T *pItem, TAccessorSharedMutex *pAccessorMutex, TGrowSharedMutex *pGrowMutex)
 
WriteGuardoperator= (T const &val)
 
WriteGuardoperator= (T &&val)
 
 ~WriteGuard ()
 Unlocks the guarded element.
 
T & get ()
 Gets the contained value. More...
 
- Public Member Functions inherited from gts::internal::GuardBase< T, TAccessorSharedMutex, TGrowSharedMutex >
 GuardBase (GuardBase const &)=delete
 
GuardBaseoperator= (GuardBase const &)=delete
 
 GuardBase (GuardBase &&other)
 
GuardBaseoperator= (GuardBase &&other)
 
 GuardBase (T *pItem, TAccessorSharedMutex *pAccessorMutex, TGrowSharedMutex *pGrowMutex)
 
T const & get () const
 Gets the contained value. More...
 
bool isValid () const
 Checks if the contained value is valid. More...
 

Additional Inherited Members

- Protected Attributes inherited from gts::internal::GuardBase< T, TAccessorSharedMutex, TGrowSharedMutex >
T * m_pItem
 
TAccessorSharedMutex * m_pAccessorMutex
 
TGrowSharedMutex * m_pGrowMutex
 

Detailed Description

template<typename T, typename TAccessorSharedMutex, typename TGrowSharedMutex>
class gts::WriteGuard< T, TAccessorSharedMutex, TGrowSharedMutex >

A read-write item guarded by a mutex. The mutex is released on destruction.

Remarks
Keeping this object alive will block other threads.

Member Function Documentation

◆ get()

template<typename T , typename TAccessorSharedMutex , typename TGrowSharedMutex >
T & WriteGuard::get ( )

Gets the contained value.

Returns
The contained value.