docs: rebuild Threading API content
This commit is contained in:
@@ -1,30 +1,26 @@
|
||||
# Mutex::TryLock
|
||||
|
||||
公开方法,详见头文件声明。
|
||||
尝试获得互斥锁。
|
||||
|
||||
```cpp
|
||||
bool TryLock();
|
||||
bool try_lock() const;
|
||||
```
|
||||
|
||||
该方法声明于 `XCEngine/Threading/Mutex.h`,当前页面用于固定 `Mutex` 类目录下的方法级 canonical 路径。
|
||||
## 行为说明
|
||||
|
||||
**参数:** 无。
|
||||
当前实现有两套入口:
|
||||
|
||||
**返回:** `bool` - 返回值语义详见头文件声明。
|
||||
- `TryLock()`:引擎风格命名。
|
||||
- `try_lock()`:标准 Lockable 风格别名。
|
||||
|
||||
**示例:**
|
||||
两者都直接调用底层 `std::mutex::try_lock()`。
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Threading/Mutex.h>
|
||||
## 返回值
|
||||
|
||||
void Example() {
|
||||
XCEngine::Threading::Mutex object;
|
||||
// 根据上下文补齐参数后调用 Mutex::TryLock(...)。
|
||||
(void)object;
|
||||
}
|
||||
```
|
||||
- `bool` - 成功获得锁时返回 `true`;否则返回 `false`。
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [返回类总览](Mutex.md)
|
||||
- [返回模块目录](../Threading.md)
|
||||
- [返回类型总览](Mutex.md)
|
||||
- [Lock](Lock.md)
|
||||
|
||||
Reference in New Issue
Block a user