Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.atnf.csiro.au/computing/software/casacore/casacore-1.2.0/doc/html/classcasa_1_1TableLock.html
Дата изменения: Unknown Дата индексирования: Mon Feb 14 21:11:24 2011 Кодировка: Поисковые слова: п п п п п п п п п п п п п п п |
Class to hold table lock options. More...
#include <TableLock.h>
Public Types | |
enum | LockOption { PermanentLocking, PermanentLockingWait, AutoLocking, UserLocking, AutoNoReadLocking, UserNoReadLocking, DefaultLocking } |
Define the possible table locking options. More... | |
Public Member Functions | |
TableLock (LockOption option=DefaultLocking) | |
Construct with given option and interval. | |
TableLock (LockOption option, double inspectionInterval, uInt maxWait=0) | |
TableLock (const TableLock &that) | |
Copy constructor. | |
TableLock & | operator= (const TableLock &that) |
Assignment. | |
void | merge (const TableLock &that) |
Merge that TableLock with this TableLock object by taking the maximum option and minimum inspection interval. | |
LockOption | option () const |
Get the locking option. | |
Bool | readLocking () const |
Is read locking needed? | |
Bool | isPermanent () const |
Is permanent locking used? | |
double | interval () const |
Get the inspection interval. | |
uInt | maxWait () const |
Get the maximum wait period in AutoLocking mode. | |
Private Member Functions | |
void | init () |
Set itsOption and itsReadLocking when needed. | |
Private Attributes | |
LockOption | itsOption |
Bool | itsReadLocking |
uInt | itsMaxWait |
double | itsInterval |
Bool | itsIsDefaultLocking |
Bool | itsIsDefaultInterval |
Class to hold table lock options.
Internal
This class keeps the Table lock options. Currently these are the LockingOption and the inspection interval.
It also keeps the LockFile
object used to do the actual locking/unlocking.
Encapsulate Table locking info.
Definition at line 65 of file TableLock.h.
Define the possible table locking options.
They offer the user the possibility to lock and synchronize access to the table. A lot of locking degrades table performance; not only because acquiring/releasing locks takes time, but especially because table data has to be synchronized (thus written to disk) when a lock is released. Otherwise the other processes see data which is not up-to-date.
PermanentLocking |
The table is permanently locked. A lock is set at the beginning and only released when the table is closed. A read lock is used when the table is opened for readonly; otherwise a write lock is used. This means that multiple readers are possible. The Table constructor exits with an exception when the lock cannot be acquired. |
PermanentLockingWait |
The same as above, but the table constructor waits until the lock gets available. |
AutoLocking |
The system takes care of acquiring/releasing locks. In principle it keeps the table locked, but from time to time (defined by the inspection interval) it is checked whether another process wants to access the table. If so, the lock is released and probably re-acquired later. This mode is the default mode. |
UserLocking |
The user is taking care of locking the table by means of the Table functions In this way transaction processing can be implemented. |
AutoNoReadLocking |
The system takes care of acquiring/releasing locks. It is similar to AutoLocking, but no locks are needed for reading. |
UserNoReadLocking |
The user is taking care of locking the table by means of the Table functions It is similar to UserLocking, but no locks are needed for reading. |
DefaultLocking |
This is the default locking option. It means that AutoLocking will be used if the table is not opened yet. Otherwise the locking options of the PlainTable objec already in use will be used. |
Definition at line 75 of file TableLock.h.
casa::TableLock::TableLock | ( | LockOption | option = DefaultLocking |
) |
Construct with given option and interval.
The default LockOption
is AutoLocking
. In case of AutloLocking the inspection interval defines how often the table system checks if another process needs a lock on the table. It defaults to 5 seconds. The maxWait defines the maximum number of seconds the table system waits when acquiring a lock in AutoLocking mode. The default is 0 seconds meaning indefinitely.
casa::TableLock::TableLock | ( | LockOption | option, | |
double | inspectionInterval, | |||
uInt | maxWait = 0 | |||
) |
casa::TableLock::TableLock | ( | const TableLock & | that | ) |
Copy constructor.
void casa::TableLock::init | ( | ) | [private] |
Set itsOption and itsReadLocking when needed.
double casa::TableLock::interval | ( | ) | const [inline] |
Bool casa::TableLock::isPermanent | ( | ) | const [inline] |
Is permanent locking used?
Definition at line 182 of file TableLock.h.
References itsOption, PermanentLocking, and PermanentLockingWait.
uInt casa::TableLock::maxWait | ( | ) | const [inline] |
Get the maximum wait period in AutoLocking mode.
Definition at line 193 of file TableLock.h.
References itsMaxWait.
void casa::TableLock::merge | ( | const TableLock & | that | ) |
TableLock::LockOption casa::TableLock::option | ( | ) | const [inline] |
Get the locking option.
Definition at line 172 of file TableLock.h.
References itsOption.
Referenced by casa::TableLockData::autoRelease().
Bool casa::TableLock::readLocking | ( | ) | const [inline] |
Is read locking needed?
Definition at line 177 of file TableLock.h.
References itsReadLocking.
Referenced by casa::ColumnSet::checkReadLock().
double casa::TableLock::itsInterval [private] |
Definition at line 161 of file TableLock.h.
Referenced by interval().
Bool casa::TableLock::itsIsDefaultInterval [private] |
Definition at line 163 of file TableLock.h.
Bool casa::TableLock::itsIsDefaultLocking [private] |
Definition at line 162 of file TableLock.h.
uInt casa::TableLock::itsMaxWait [private] |
Definition at line 160 of file TableLock.h.
Referenced by maxWait().
LockOption casa::TableLock::itsOption [private] |
Definition at line 158 of file TableLock.h.
Referenced by isPermanent(), and option().
Bool casa::TableLock::itsReadLocking [private] |
Definition at line 159 of file TableLock.h.
Referenced by readLocking().