OpenLexocad  27.1
Core::TransactionLocker Class Reference

#include <AutoTransaction.h>

Public Member Functions

 TransactionLocker (bool lock=true)
 
 ~TransactionLocker ()
 
void activate (bool enable)
 
bool isActive () const
 Check if the locker is active. More...
 

Static Public Member Functions

static bool isLocked ()
 Check if transaction is being locked. More...
 

Friends

class CoreApplication
 

Detailed Description

Helper class to lock a transaction from being closed or aborted.

The helper class is used to protect some critical transaction from being closed prematurely, e.g. when deleting some object.

Constructor & Destructor Documentation

◆ TransactionLocker()

Core::TransactionLocker::TransactionLocker ( bool  lock = true)

Constructor

Parameters
lockwhether to activate the lock

◆ ~TransactionLocker()

Core::TransactionLocker::~TransactionLocker ( )

Destructor Unlock the transaction is this locker is active

Member Function Documentation

◆ activate()

void Core::TransactionLocker::activate ( bool  enable)

Activate or deactivate this locker

Parameters
enablewhether to activate the locker

An internal counter is used to support recursive locker. When activated, the current active transaction cannot be closed or aborted. But the closing call (Application::closeActiveTransaction()) will be remembered, and performed when the internal lock counter reaches zero.

◆ isActive()

bool Core::TransactionLocker::isActive ( ) const
inline

Check if the locker is active.

◆ isLocked()

static bool Core::TransactionLocker::isLocked ( )
static

Check if transaction is being locked.

Friends And Related Function Documentation

◆ CoreApplication

friend class CoreApplication
friend

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