Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.atnf.csiro.au/computing/software/casacore/casacore-1.2.0/doc/html/classcasa_1_1ExternalLockSync.html
Дата изменения: Unknown Дата индексирования: Mon Feb 14 22:46:51 2011 Кодировка: Поисковые слова: ion drive |
Class to hold table lock data. More...
#include <ExternalLockSync.h>
Public Member Functions | |
ExternalLockSync (const TableLock &lockOptions) | |
Construct from the given TableLock object. | |
~ExternalLockSync () | |
void | makeLock (const String &tableName, Bool create, FileLocker::LockType) |
Create the LockFile object and acquire a read or write lock when permanent locking is in effect. | |
Bool | acquire (FileLocker::LockType=FileLocker::Write, uInt nattempts=0) |
Acquire a read or write lock (when needed). | |
uInt | nrow () const |
Get the current number of rows in this object. | |
void | release (uInt nrrow) |
Release the lock and synchronize the table access. | |
Bool | hasLock (FileLocker::LockType) const |
Check if the table has a read or write lock, thus if the table can be read or written safely. | |
Private Member Functions | |
ExternalLockSync (const ExternalLockSync &that) | |
Copy constructor is forbidden. | |
ExternalLockSync & | operator= (const ExternalLockSync &that) |
Assignment is forbidden. | |
MemoryIO * | doReleaseCallBack (Bool always) |
The member function executing the callback functionality. | |
Static Private Member Functions | |
static MemoryIO * | releaseCallBack (void *lockSyncObject, Bool always) |
The callback function when releasing a lock. | |
Private Attributes | |
TableLockData | itsLock |
TableSyncData | itsSync |
uInt | itsNrrow |
Class to hold table lock data.
Internal
This class keeps the LockFile
object used to do the actual locking/unlocking. It also keeps the synchronization information.
Encapsulate Table locking data.
Definition at line 62 of file ExternalLockSync.h.
casa::ExternalLockSync::ExternalLockSync | ( | const TableLock & | lockOptions | ) |
Construct from the given TableLock object.
casa::ExternalLockSync::~ExternalLockSync | ( | ) |
casa::ExternalLockSync::ExternalLockSync | ( | const ExternalLockSync & | that | ) | [private] |
Copy constructor is forbidden.
Bool casa::ExternalLockSync::acquire | ( | FileLocker::LockType | = FileLocker::Write , |
|
uInt | nattempts = 0 | |||
) |
Acquire a read or write lock (when needed).
Nattempts==0 indicates that it has to wait until the lock is acquired. Nattempts>0 indicates that it gives up acquiring the lock when nattempts have been done (with 1 second intervals). It throws an exception when acquire failed while it had to wait. It returns a false status when acquiring the lock failed while it does not have to wait.
When a lock is successfully acquired, the number of rows (see function nrrow() below) is reset as a result of synchronizing the access to the table.
The member function executing the callback functionality.
Definition at line 132 of file ExternalLockSync.h.
Bool casa::ExternalLockSync::hasLock | ( | FileLocker::LockType | type | ) | const [inline] |
Check if the table has a read or write lock, thus if the table can be read or written safely.
Definition at line 123 of file ExternalLockSync.h.
void casa::ExternalLockSync::makeLock | ( | const String & | tableName, | |
Bool | create, | |||
FileLocker::LockType | ||||
) |
Create the LockFile
object and acquire a read or write lock when permanent locking is in effect.
It throws an exception when acquiring the lock failed.
uInt casa::ExternalLockSync::nrow | ( | ) | const [inline] |
Get the current number of rows in this object.
Definition at line 137 of file ExternalLockSync.h.
ExternalLockSync& casa::ExternalLockSync::operator= | ( | const ExternalLockSync & | that | ) | [private] |
Assignment is forbidden.
void casa::ExternalLockSync::release | ( | uInt | nrrow | ) | [inline] |
Release the lock and synchronize the table access.
When autolocking is in effect, the lock is only released when the inspection-interval (see class TableLockData ) has expired. It does nothing when permanent locking is used. It throws an exception when the release failed.
Definition at line 127 of file ExternalLockSync.h.
static MemoryIO* casa::ExternalLockSync::releaseCallBack | ( | void * | lockSyncObject, | |
Bool | always | |||
) | [static, private] |
The callback function when releasing a lock.
TableLockData casa::ExternalLockSync::itsLock [private] |
Definition at line 90 of file ExternalLockSync.h.
uInt casa::ExternalLockSync::itsNrrow [private] |
Definition at line 92 of file ExternalLockSync.h.
TableSyncData casa::ExternalLockSync::itsSync [private] |
Definition at line 91 of file ExternalLockSync.h.