My Project
Loading...
Searching...
No Matches
LibThread::Transactional Class Reference

Public Member Functions

 Transactional ()
 
void set_region (Region *region_init)
 
virtual ~Transactional ()
 
- Public Member Functions inherited from LibThread::SharedObject
 SharedObject ()
 
virtual ~SharedObject ()
 
void set_type (int type_init)
 
int get_type ()
 
void set_name (std::string &name_init)
 
void set_name (const char *s)
 
std::string & get_name ()
 
void incref (int by=1)
 
long decref ()
 
long getref ()
 
virtual BOOLEAN op2 (int op, leftv res, leftv a1, leftv a2)
 
virtual BOOLEAN op3 (int op, leftv res, leftv a1, leftv a2, leftv a3)
 

Protected Member Functions

int tx_begin ()
 
void tx_end ()
 

Private Attributes

Regionregion
 
Locklock
 

Detailed Description

Definition at line 281 of file shared.cc.

Constructor & Destructor Documentation

◆ Transactional()

LibThread::Transactional::Transactional ( )
inline

Definition at line 301 of file shared.cc.

301 :
303 }
#define NULL
Definition omList.c:12

◆ ~Transactional()

virtual LibThread::Transactional::~Transactional ( )
inlinevirtual

Definition at line 312 of file shared.cc.

312{ if (!region && lock) delete lock; }

Member Function Documentation

◆ set_region()

void LibThread::Transactional::set_region ( Region * region_init)
inline

Definition at line 304 of file shared.cc.

304 {
305 region = region_init;
306 if (region_init) {
307 lock = region_init->get_lock();
308 } else {
309 lock = new Lock();
310 }
311 }
Lock * get_lock()
Definition shared.cc:207

◆ tx_begin()

int LibThread::Transactional::tx_begin ( )
inlineprotected

Definition at line 286 of file shared.cc.

286 {
287 if (!region)
288 lock->lock();
289 else {
290 if (!lock->is_locked()) {
291 return 0;
292 }
293 }
294 return 1;
295 }

◆ tx_end()

void LibThread::Transactional::tx_end ( )
inlineprotected

Definition at line 296 of file shared.cc.

296 {
297 if (!region)
298 lock->unlock();
299 }

Field Documentation

◆ lock

Lock* LibThread::Transactional::lock
private

Definition at line 284 of file shared.cc.

◆ region

Region* LibThread::Transactional::region
private

Definition at line 283 of file shared.cc.


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