Sese Framework  3.0.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::system::FileLocker Class Reference

File locker. More...

#include <FileLocker.h>

Classes

class  Impl
 

Public Member Functions

 FileLocker (int32_t fd)
 
 ~FileLocker ()
 
bool lockWrite (int64_t start, int64_t len)
 
bool lockRead (int64_t start, int64_t len)
 
bool lock (int64_t start, int64_t len)
 
bool unlock ()
 

Private Attributes

std::unique_ptr< Implimpl
 

Detailed Description

File locker.

Constructor & Destructor Documentation

◆ FileLocker()

FileLocker::FileLocker ( int32_t fd)
explicit

Initialize a file lock based on the file descriptor

Parameters
fdFile descriptor

◆ ~FileLocker()

FileLocker::~FileLocker ( )

Member Function Documentation

◆ lock()

bool FileLocker::lock ( int64_t start,
int64_t len )
nodiscard

Apply a lock to the current file

Parameters
startStarting offset
lenLength
Returns
Whether the lock was successfully applied

References impl.

◆ lockRead()

bool FileLocker::lockRead ( int64_t start,
int64_t len )
nodiscard

Apply a read lock to the current file

Parameters
startStarting offset
lenLength
Returns
Whether the lock was successfully applied

References impl.

◆ lockWrite()

bool FileLocker::lockWrite ( int64_t start,
int64_t len )
nodiscard

Apply a write lock to the current file

Parameters
startStarting offset
lenLength
Returns
Whether the lock was successfully applied

References impl.

◆ unlock()

bool FileLocker::unlock ( )
nodiscard

Unlock the current file

Returns
Whether the unlock operation was successful

References impl.

Member Data Documentation

◆ impl

std::unique_ptr<Impl> sese::system::FileLocker::impl
private

Referenced by lock(), lockRead(), lockWrite(), and unlock().


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