My Project
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes
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 286 of file shared.cc.

Constructor & Destructor Documentation

◆ Transactional()

LibThread::Transactional::Transactional ( )
inline

Definition at line 306 of file shared.cc.

306 :
308 }
#define NULL
Definition: omList.c:12

◆ ~Transactional()

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

Definition at line 317 of file shared.cc.

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

Member Function Documentation

◆ set_region()

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

Definition at line 309 of file shared.cc.

309 {
310 region = region_init;
311 if (region_init) {
312 lock = region_init->get_lock();
313 } else {
314 lock = new Lock();
315 }
316 }
Lock * get_lock()
Definition: shared.cc:212
Definition: thread.h:17

◆ tx_begin()

int LibThread::Transactional::tx_begin ( )
inlineprotected

Definition at line 291 of file shared.cc.

291 {
292 if (!region)
293 lock->lock();
294 else {
295 if (!lock->is_locked()) {
296 return 0;
297 }
298 }
299 return 1;
300 }
bool is_locked()
Definition: thread.h:68
void lock()
Definition: thread.h:46

◆ tx_end()

void LibThread::Transactional::tx_end ( )
inlineprotected

Definition at line 301 of file shared.cc.

301 {
302 if (!region)
303 lock->unlock();
304 }
void unlock()
Definition: thread.h:57

Field Documentation

◆ lock

Lock* LibThread::Transactional::lock
private

Definition at line 289 of file shared.cc.

◆ region

Region* LibThread::Transactional::region
private

Definition at line 288 of file shared.cc.


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