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

File locker. More...

#include <FileLocker.h>

Public Member Functions

 FileLocker (int32_t fd)
 
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

int32_t fd {}
 

Detailed Description

File locker.

Constructor & Destructor Documentation

◆ FileLocker()

sese::system::FileLocker::FileLocker ( int32_t fd)
inlineexplicit

Initialize a file lock based on the file descriptor

Parameters
fdFile descriptor

Member Function Documentation

◆ lock()

bool sese::system::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

Referenced by lockWrite().

◆ lockRead()

bool sese::system::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

◆ lockWrite()

bool sese::system::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 fd, and lock().

◆ unlock()

bool sese::system::FileLocker::unlock ( )
nodiscard

Unlock the current file

Returns
Whether the unlock operation was successful

Member Data Documentation

◆ fd

int32_t sese::system::FileLocker::fd {}
private

Referenced by lockWrite().


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