docs: rebuild Threading API content

This commit is contained in:
2026-03-26 20:59:59 +08:00
parent 9a2d77b81d
commit 8f486611d5
78 changed files with 1648 additions and 1061 deletions

View File

@@ -6,32 +6,36 @@
**头文件**: `XCEngine/Threading/Mutex.h`
**描述**: 定义 `XCEngine/Threading` 子目录中的 `Mutex` public API
**描述**: `std::mutex` 的薄封装,同时提供引擎风格和 STL Lockable 风格接口
## 概述
`Mutex.h` `XCEngine/Threading` 子目录 下的 public header当前页面作为平行目录中的 canonical 总览,用于汇总该头文件暴露的主要声明
`Mutex` 的实现非常直接:内部只有一个 `mutable std::mutex m_mutex`,所有公开接口都是对它的转发
## 声明概览
这类包装在引擎里常见的原因不是为了改变 `std::mutex` 的行为,而是为了:
| 声明 | 类型 | 说明 |
|------|------|------|
| `Mutex` | `class` | 头文件中的公开声明。 |
- 统一命名空间与 include 路径。
- 同时支持 `Lock()` 这种引擎风格接口。
- 也支持 `lock()` / `unlock()` / `try_lock()` 这种标准库 Lockable 习惯用法。
## 公共方法
## 当前实现边界
| 方法 | 描述 |
- 它不是递归锁;同一线程重复加锁会死锁。
- 没有超时锁接口。
- 没有显式的 owner 检查或调试断言。
- 小写接口之所以能声明成 `const`,是因为底层 `std::mutex` 被保存为 `mutable`
## 公开方法
| 方法 | 说明 |
|------|------|
| [Mutex()](Constructor.md) | 构造对象。 |
| [~Mutex()](Destructor.md) | 销毁对象并释放相关资源。 |
| [Lock](Lock.md) | 公开方法,详见头文件声明。 |
| [Unlock](Unlock.md) | 公开方法,详见头文件声明。 |
| [TryLock](TryLock.md) | 公开方法,详见头文件声明。 |
| [lock](lock.md) | 公开方法,详见头文件声明。 |
| [unlock](unlock.md) | 公开方法,详见头文件声明。 |
| [try_lock](try_lock.md) | 公开方法,详见头文件声明。 |
| [Constructor](Constructor.md) | 默认构造互斥锁。 |
| [Destructor](Destructor.md) | 销毁互斥锁。 |
| [Lock](Lock.md) | 阻塞直到获得锁;同页也说明 `lock()` 别名。 |
| [Unlock](Unlock.md) | 释放锁;同页也说明 `unlock()` 别名。 |
| [TryLock](TryLock.md) | 尝试获得锁;同页也说明 `try_lock()` 别名。 |
## 相关文档
- [当前目录](../Threading.md) - 返回 `Threading` 平行目录
- [API 总索引](../../../main.md) - 返回顶层索引
- [当前模块](../Threading.md)
- [SpinLock](../SpinLock/SpinLock.md)