CoreComponents 3.0.0
A Modern C++ Toolkit
Loading...
Searching...
No Matches

Advisory file lock. More...

#include <cc/FileLock>

Inheritance diagram for FileLock:

Public Member Functions

 FileLock (const File &file, FileContention type, long long start=0, long long length=0, Seek whence=Seek::Begin)
 Create an advisory file lock for a file area.
 
 FileLock (const File &file, FileContention type, long long start, Seek whence=Seek::Begin)
 Create an advisory file lock for a file area.
 
bool tryAcquire ()
 Try to acquire the file lock.
 
void acquire ()
 Wait and acquire lock.
 
void release ()
 Release lock.
 

Detailed Description

Advisory file lock.

See also
Guard
Exceptions
SystemError

Constructor & Destructor Documentation

◆ FileLock() [1/2]

FileLock ( const File & file,
FileContention type,
long long start = 0,
long long length = 0,
Seek whence = Seek::Begin )

Create an advisory file lock for a file area.

Parameters
fileFile to lock
typeType of lock
startStart offset of the file area
lengthLength of the file area
whenceInterpretation of start offset

◆ FileLock() [2/2]

FileLock ( const File & file,
FileContention type,
long long start,
Seek whence = Seek::Begin )

Create an advisory file lock for a file area.

Parameters
fileFile to lock
typeType of lock
startStart offset of the file area
whenceInterpretation of start offset

Member Function Documentation

◆ tryAcquire()

bool tryAcquire ( )

Try to acquire the file lock.

Returns
True if lock could be successfully acquired

◆ acquire()

void acquire ( )

Wait and acquire lock.

◆ release()

void release ( )

Release lock.