FlintLock Class Reference

#include <flint_lock.h>

Collaboration diagram for FlintLock:

Collaboration graph
[legend]

List of all members.

Public Types

enum  reason {
  SUCCESS, INUSE, UNSUPPORTED, FDLIMIT,
  UNKNOWN
}

Public Member Functions

 FlintLock (const std::string &filename_)
 operator bool () const
 ~FlintLock ()
reason lock (bool exclusive, std::string &explanation)
 Attempt to obtain the lock.
void release ()
 Release the lock.
 XAPIAN_NORETURN (void throw_databaselockerror(FlintLock::reason why, const std::string &db_dir, const std::string &explanation))
 Throw Xapian::DatabaseLockError.

Private Attributes

std::string filename
int fd
pid_t pid


Detailed Description

Definition at line 39 of file flint_lock.h.


Member Enumeration Documentation

Enumerator:
SUCCESS 
INUSE 
UNSUPPORTED 
FDLIMIT 
UNKNOWN 

Definition at line 51 of file flint_lock.h.


Constructor & Destructor Documentation

FlintLock::FlintLock ( const std::string &  filename_  )  [inline]

Definition at line 75 of file flint_lock.h.

References filename.

FlintLock::~FlintLock (  )  [inline]

Definition at line 81 of file flint_lock.h.

References release().


Member Function Documentation

FlintLock::reason FlintLock::lock ( bool  exclusive,
std::string &  explanation 
)

Attempt to obtain the lock.

If the attempt fails with code "UNKNOWN", the string supplied in the explanation parameter will be set to contain any details available of the reason for the failure.

Definition at line 51 of file flint_lock.cc.

References Assert, Xapian::Internal::closefrom(), fd, FDLIMIT, filename, INUSE, Xapian::InMemory::open(), pid, rare, SUCCESS, UNKNOWN, and UNSUPPORTED.

Referenced by FlintDatabaseReplicator::apply_changeset_from_conn(), ChertDatabaseReplicator::apply_changeset_from_conn(), BrassDatabaseReplicator::apply_changeset_from_conn(), FlintDatabase::get_database_write_lock(), ChertDatabase::get_database_write_lock(), and BrassDatabase::get_database_write_lock().

FlintLock::operator bool (  )  const [inline]

Definition at line 78 of file flint_lock.h.

References fd.

void FlintLock::release (  ) 

Release the lock.

Definition at line 255 of file flint_lock.cc.

References fd, and pid.

Referenced by FlintDatabase::close(), ChertDatabase::close(), BrassDatabase::close(), and ~FlintLock().

FlintLock::XAPIAN_NORETURN ( void   throw_databaselockerrorFlintLock::reason why, const std::string &db_dir, const std::string &explanation  ) 


Member Data Documentation

int FlintLock::fd [private]

Definition at line 46 of file flint_lock.h.

Referenced by lock(), operator bool(), and release().

std::string FlintLock::filename [private]

Definition at line 40 of file flint_lock.h.

Referenced by FlintLock(), and lock().

pid_t FlintLock::pid [private]

Definition at line 47 of file flint_lock.h.

Referenced by lock(), and release().


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

Documentation for Xapian (version 1.2.13).
Generated on 9 Jan 2013 by Doxygen 1.5.9.