ost::ThreadFile(3)
π ost::ThreadFile β from the Library Functions Manual (yes bestie, section 3) π
okay so. imagine a database file that a whole squad of threads can vibe with at the same time. that's this. π«Ά
β¨ NAME β¨
ost::ThreadFile β this class defines a database I/O file service that can be shared by multiple threads. π
πΈ SYNOPSIS πΈ
#include <file.h>
Inherits ost::RandomFile. it's giving inheritance. it's giving lineage. π
π Public Member Functions π
ThreadFile(const char *path)β open or create a new database file.virtual ~ThreadFile ()β 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)β 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 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 π¦
(yes, there's more, it's giving family tree π³)
π Detailed Description π
This class defines a database I/O file service that can be shared by multiple threads. no cap.
Every single thread accesses a global copy of the database object, and mutex locks can be used to preserve transaction integrety. (yes, "integrety" β that's how it's spelled in the source, don't come for me π) pread/pwrite calls can be used for optimized I/O when supported. slay.
ThreadFile is meant for use by a threaded database server where multiple threads may each perform semi-independent operations on a given database table stored on disk. A special 'fcb' structure is used to hold file 'state', and pread/pwrite is used whenever possible for optimized I/O. On systems that do not offer pwread/pwrite, a Mutex lock is used to protect concurrent lseek and read/write operations. ThreadFile managed databases are assumed to be used only by the local server and through a single file descriptor.
fr fr: single file descriptor, local server only. don't get cute with it. π
π Author π
David Sugar dyfet@ostel.com
This class defines a database I/O file service that can be shared by multiple threads. (yes it says it again, iconic repetition, main character energy π )
π Constructor & Destructor Documentation π
π ost::ThreadFile::ThreadFile (const char * path)
Open or create a new database file. You should also use Initial.
Parameters
- path β pathname of database to open.
π virtual ost::ThreadFile::~ThreadFile () [virtual]
Close and finish a database file.
β Member Function Documentation β
πΈ Error ost::ThreadFile::append (caddr_t address = NULL, ccxx_size_t length = 0)
Add new data to the end of the file.
Parameters
- address β address to use, or
NULLif same as last I/O. - length β length to use, or
0if same as last I/O.
πΈ Error ost::ThreadFile::fetch (caddr_t address = NULL, ccxx_size_t length = 0, off_t position = -1)
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
NULLif same as last I/O. - length β length to use, or
0if same as last I/O. - position β file position to use
-1if same as last I/O.
πΈ off_t ost::ThreadFile::getPosition (void)
Fetch the current file position marker for this thread.
Returns
file position offset.
πΈ bool ost::ThreadFile::operator++ (void)
πΈ bool ost::ThreadFile::operator-- (void)
πΈ Error ost::ThreadFile::restart (void) [virtual]
Restart an existing database; close and re-open.
Returns
errSuccess if successful.
Reimplemented from ost::RandomFile.
πΈ Error ost::ThreadFile::update (caddr_t address = NULL, ccxx_size_t length = 0, off_t position = -1)
Update a portion of a file from physical memory. This can use state information to commit the last read record.
Returns
errSuccess on success.
Parameters
- address β address to use, or
NULLif same as last I/O. - length β length to use, or
0if same as last I/O. - position β file position to use or
-1if same as last I/O.
π Author π
Generated automatically by Doxygen for GNU CommonC++ from the source code.
okay that's the whole page bestie, go forth and thread safely π§π
GNU CommonC++ Β· Sun Dec 27 2020 Β· ost::ThreadFile(3) β mwah, that's a wrap, periodt. π β¨π
π¦ where this page comes from
- ubuntu jammy: libcommoncpp2-doc 1.8.1-10
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms