|
NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
文件区域锁守卫 更多...
#include <file_locker.hpp>
Public 类型 | |
| using | difference_type = file_locker::difference_type |
| 偏移量类型 | |
Public 成员函数 | |
| file_lock_guard (file_locker &locker, difference_type offset, difference_type length, file_lock mode) | |
| 构造函数,立即获取锁 | |
| ~file_lock_guard () | |
| 析构函数,自动释放锁 | |
| NEFORCE_NODISCARD bool | is_locked () const noexcept |
| 检查是否持有锁 | |
| bool | unlock () noexcept |
| 手动释放锁 | |
| file_lock_guard::file_lock_guard | ( | file_locker & | locker, |
| difference_type | offset, | ||
| difference_type | length, | ||
| file_lock | mode ) |
构造函数,立即获取锁
| locker | 文件锁管理器 |
| offset | 锁定起始偏移 |
| length | 锁定长度 |
| mode | 锁定模式 |
在构造时尝试获取锁。如果获取失败,locked_标志为false。
被这些函数引用 ~file_lock_guard().
| file_lock_guard::~file_lock_guard | ( | ) |
|
inlinenoexcept |
|
noexcept |
手动释放锁
提前释放锁,之后析构函数不会再尝试释放。 释放后is_locked()返回false。