ost::Lockfile(3) Library Functions Manual ost::Lockfile(3)NAME
ost::Lockfile -
This class is used to create a 'named' lock entity that can be used to control access to a resource between multiple processes.
SYNOPSIS
#include <process.h>
Public Member Functions
Lockfile (const char *name)
Create a lock under a known name.
Lockfile ()
Create a new lock object that can be used to make locks.
~Lockfile ()
Destroy the current lock and release it.
bool lock (const char *name)
Lock a system-wide name for this process.
void unlock (void)
Release an acquired lock.
bool isLocked (void)
Flag if the current process has aqcuired a lock.
Detailed Description
This class is used to create a 'named' lock entity that can be used to control access to a resource between multiple processes.
The posix implimentation uses a pidfile and the win32 version uses a globally visible mutex.
Author:
David Sugar dyfet@ostel.com System-wide named lock
Constructor & Destructor Documentation
ost::Lockfile::Lockfile (const char *name)
Create a lock under a known name. Parameters:
name of system-wide lock to create.
ost::Lockfile::Lockfile ()
Create a new lock object that can be used to make locks.
ost::Lockfile::~Lockfile () [inline]
Destroy the current lock and release it.
Member Function Documentation
bool ost::Lockfile::isLocked (void)
Flag if the current process has aqcuired a lock. Returns:
true if we have the lock.
bool ost::Lockfile::lock (const char *name)
Lock a system-wide name for this process. If the lock is successful, return true. If an existing lock was already acquired, release it
first.
Returns:
true if lock successful.
Parameters:
name system-wide lock to use.
void ost::Lockfile::unlock (void)
Release an acquired lock.
Author
Generated automatically by Doxygen for GNU CommonC++ from the source code.
GNU CommonC++ Sat Jun 23 2012 ost::Lockfile(3)
Check Out this Related Man Page
ost::SharedFile(3) Library Functions Manual ost::SharedFile(3)NAME
ost::SharedFile -
This class defines a database I/O file service that can be shared by multiple processes.
SYNOPSIS
#include <file.h>
Inherits ost::RandomFile.
Public Member Functions
SharedFile (const char *path)
Open or create a new database file.
SharedFile (const SharedFile &file)
Create a shared file as a duplicate of an existing shared file.
virtual ~SharedFile ()
Close and finish a database file.
Error restart (void)
Restart an existing database; close and re-open.
Error fetch (caddr_t address=NULL, ccxx_size_t length=0, off_t position=-1)
Lock and Fetch a portion of the file into physical memory.
Error update (caddr_t address=NULL, ccxx_size_t length=0, off_t position=-1)
Update a portion of a file from physical memory.
Error clear (ccxx_size_t length=0, off_t pos=-1)
Clear a lock held from a previous fetch operation without updating.
Error append (caddr_t address=NULL, ccxx_size_t length=0)
Add new data to the end of the file.
off_t getPosition (void)
Fetch the current file position marker for this thread.
bool operator++ (void)
bool operator-- (void)
Additional Inherited Members
Detailed Description
This class defines a database I/O file service that can be shared by multiple processes.
Each thread should access a dup of the database object, and mutex locks can be used to preserve transaction integrety if multiple threads
are used.
SharedFile is used when a database may be shared between multiple processes. SharedFile automatically applies low level byte-range 'file
locks', and provides an interface to fetch and release byte-range locked portions of a file.
Author:
David Sugar dyfet@ostel.com This class defines a database I/O file service that can be shared by multiple processes.
Constructor & Destructor Documentation
ost::SharedFile::SharedFile (const char *path)
Open or create a new database file. You should also use Initial.
Parameters:
path pathname of database to open.
ost::SharedFile::SharedFile (const SharedFile &file)
Create a shared file as a duplicate of an existing shared file. Parameters:
file original file.
virtual ost::SharedFile::~SharedFile () [virtual]
Close and finish a database file.
Member Function Documentation
Error ost::SharedFile::append (caddr_taddress = NULL, ccxx_size_tlength = 0)
Add new data to the end of the file. Locks file during append.
@param address address to use, or NULL if same as last I/O.
@param length length to use, or 0 if same as last I/O.
Error ost::SharedFile::clear (ccxx_size_tlength = 0, off_tpos = -1)
Clear a lock held from a previous fetch operation without updating. Returns:
errSuccess on success.
Parameters:
length length to use, or 0 if same as last I/O.
pos file position to use or -1 if same as last I/O.
Error ost::SharedFile::fetch (caddr_taddress = NULL, ccxx_size_tlength = 0, off_tposition = -1)
Lock and Fetch a portion of the file into physical memory. This can use state information to fetch the current record multiple times.
Returns:
errSuccess on success.
Parameters:
address address to use, or NULL if same as last I/O.
length length to use, or 0 if same as last I/O.
position file position to use -1 if same as last I/O.
off_t ost::SharedFile::getPosition (void)
Fetch the current file position marker for this thread. Returns:
file position offset.
bool ost::SharedFile::operator++ (void)
bool ost::SharedFile::operator-- (void)
Error ost::SharedFile::restart (void) [inline], [virtual]
Restart an existing database; close and re-open. Returns:
errSuccess if successful.
Reimplemented from ost::RandomFile.
Error ost::SharedFile::update (caddr_taddress = NULL, ccxx_size_tlength = 0, off_tposition = -1)
Update a portion of a file from physical memory. This can use state information to commit the last read record. The current lock is also
cleared.
Returns:
errSuccess on success.
Parameters:
address address to use, or NULL if same as last I/O.
length length to use, or 0 if same as last I/O.
position file position to use or -1 if same as last I/O.
Author
Generated automatically by Doxygen for GNU CommonC++ from the source code.
GNU CommonC++ Sat Jun 23 2012 ost::SharedFile(3)