NewLang Project
Yet another programm language
Loading...
Searching...
No Matches
newlang::Sync Class Reference

#include <variable.h>

Public Member Functions

 Sync (RefType type, const std::chrono::milliseconds &timeout_duration=SyncTimeoutDeedlock)
 
RefType GetRefType () const
 
std::thread::id GetThreadId () const
 
bool SyncLock (bool edit_mode=true, const std::chrono::milliseconds &timeout_duration=Sync::SyncTimeoutDeedlock)
 
bool SyncUnLock ()
 
virtual ~Sync ()
 

Static Public Member Functions

static std::shared_ptr< SyncCreateSync (const TermPtr &term)
 
static std::shared_ptr< SyncCreateSync (const std::string_view ref)
 

Static Public Attributes

static constexpr std::chrono::milliseconds SyncTimeoutDeedlock = std::chrono::milliseconds(5000)
 
static constexpr std::chrono::seconds SyncWithoutWait = std::chrono::seconds(0)
 

Protected Attributes

const RefType m_type
 
const std::thread::id m_thread_id
 
const std::chrono::milliseconds & m_timeout
 
std::variant< std::monostate, std::shared_timed_mutex, std::recursive_timed_mutex > m_sync
 
std::shared_ptr< Variablem_data
 Поле данных для использования в классе VariableTaken, чтобы уменьшить размер класса Variable.
 

Friends

class VariableTaken
 

Detailed Description

Класс захвата/освобождения объекта межпотоковой синхронизации Хранит опции захвата и содерит поле для ссылкы на защищаемую переменную.

Definition at line 138 of file variable.h.

Constructor & Destructor Documentation

◆ Sync()

◆ ~Sync()

virtual newlang::Sync::~Sync ( )
inlinevirtual

Definition at line 213 of file variable.h.

Member Function Documentation

◆ CreateSync() [1/2]

std::shared_ptr< Sync > Sync::CreateSync ( const TermPtr & term)
static

Definition at line 37 of file variable.cpp.

References CreateSync().

Referenced by CreateSync().

◆ CreateSync() [2/2]

std::shared_ptr< Sync > Sync::CreateSync ( const std::string_view ref)
static

◆ GetRefType()

RefType newlang::Sync::GetRefType ( ) const
inline

Definition at line 172 of file variable.h.

References m_type.

◆ GetThreadId()

std::thread::id newlang::Sync::GetThreadId ( ) const
inline

Definition at line 176 of file variable.h.

References m_thread_id.

◆ SyncLock()

bool newlang::Sync::SyncLock ( bool edit_mode = true,
const std::chrono::milliseconds & timeout_duration = Sync::SyncTimeoutDeedlock )
inline

◆ SyncUnLock()

Friends And Related Symbol Documentation

◆ VariableTaken

friend class VariableTaken
friend

Definition at line 140 of file variable.h.

Member Data Documentation

◆ m_type

const RefType newlang::Sync::m_type
protected

Definition at line 142 of file variable.h.

Referenced by GetRefType(), Sync(), SyncLock(), and SyncUnLock().

◆ m_thread_id

const std::thread::id newlang::Sync::m_thread_id
protected

Definition at line 143 of file variable.h.

Referenced by GetThreadId(), SyncLock(), and SyncUnLock().

◆ m_timeout

const std::chrono::milliseconds& newlang::Sync::m_timeout
protected

Definition at line 144 of file variable.h.

Referenced by SyncLock().

◆ m_sync

std::variant<std::monostate, std::shared_timed_mutex, std::recursive_timed_mutex> newlang::Sync::m_sync
mutableprotected

Definition at line 146 of file variable.h.

Referenced by Sync(), SyncLock(), and SyncUnLock().

◆ m_data

std::shared_ptr<Variable> newlang::Sync::m_data
protected

Поле данных для использования в классе VariableTaken, чтобы уменьшить размер класса Variable.

Definition at line 148 of file variable.h.

◆ SyncTimeoutDeedlock

std::chrono::milliseconds newlang::Sync::SyncTimeoutDeedlock = std::chrono::milliseconds(5000)
staticconstexpr

Definition at line 152 of file variable.h.

Referenced by SyncLock().

◆ SyncWithoutWait

std::chrono::seconds newlang::Sync::SyncWithoutWait = std::chrono::seconds(0)
staticconstexpr

Definition at line 153 of file variable.h.


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