UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Protected Member Functions | Static Protected Attributes | List of all members
Lock Class Reference

#include <Lock.H>

Inheritance diagram for Lock:
AtExitLock DbLock FileLock ProcessLock DbLockTable

Public Member Functions

 Lock ()
 
virtual ~Lock ()
 
LockId lock_id () const
 

Protected Member Functions

void lock ()
 
void unlock ()
 

Static Protected Attributes

static LocksAr * plocksar
 

Detailed Description

Lock is a base object for all kinds of locks made by a program. All locks that are made by program are registered and almost always will be unlocked at program's end. Handled circumstances include return from main(), doing exit() (but not _exit()!), aborting due to signal (except for SIGKILL(#9) and severe memory damage).

Application specific definition of the Lock-inherited objects is deriving new object type from Lock (see FileLock for example) and redefining constructor and destructor so that the first provides suitable lock technique and the last - unlock technique.

Lock as transaction brackets lives while Lock-inherited object exists. If some lock must exist only inside some (exception free!) program scope, it can be made as an automatic object. If one need lock with inter-function behavior, one must create instance of lock object in dynamic memory.

Constructor & Destructor Documentation

Lock::Lock ( )

Doing lock here. While the object exists, corresponding resource is considered as locked. Never mind, in program, in system or in project scope.

virtual Lock::~Lock ( )
virtual

Destruction of the object is considered as unlinking it from manager and unlocking the resource.

Member Function Documentation

void Lock::lock ( )
protected

Doing lock here.

LockId Lock::lock_id ( ) const

Returns identifier of the lock.

void Lock::unlock ( )
protected

Doing unlock here.

Member Data Documentation

LocksAr* Lock::plocksar
staticprotected

Global list of pointers at locks made by a program. Index of the lock is so-called LockId.


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