docs: fix threading module documentation discrepancies
- Fix SpinLock docs: clarify lock()/unlock()/try_lock() are non-const (matching source implementation in SpinLock.h) - Add missing LambdaTask::Execute() method to inherited methods table - Update TaskGroup::Wait() docs: clarify m_pendingCount never decrements causing indefinite block even after all tasks complete (not just unexecuted tasks) - Update TaskGroup::IsComplete() docs: document same m_pendingCount issue causing incorrect return values
This commit is contained in:
@@ -24,6 +24,12 @@
|
||||
|------|------|
|
||||
| [`LambdaTask`](constructor.md) | 构造 Lambda 任务 |
|
||||
|
||||
## 继承方法
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| `Execute()` | 执行封装的可调用对象(继承自 ITask,可重写) |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
## STL 兼容方法
|
||||
|
||||
支持 `lock()`, `unlock()`, `try_lock()` 以兼容 STL 的 lockable 概念。
|
||||
支持 `lock()`, `unlock()`, `try_lock()` 以兼容 STL 的 lockable 概念。**注意**:这些方法为非 `const` 成员函数。
|
||||
|
||||
## 使用示例
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ bool IsComplete() const
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**注意:** 由于实现缺陷,`m_pendingCount` 计数器在任务完成后不会递减,因此此方法在所有任务执行完毕后仍会错误地返回 false。
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
|
||||
@@ -14,7 +14,7 @@ void Wait()
|
||||
|
||||
**注意:**
|
||||
- 如果任务组已被取消,此方法将立即返回。
|
||||
- 如果任务组中还有未执行且未被取消的任务,调用此方法将永久阻塞(这是当前实现的限制)。
|
||||
- **警告**:由于实现缺陷,`m_pendingCount` 计数器在任务完成后不会递减,导致 `Wait()` 在所有任务执行完毕后仍会永久阻塞。这是当前实现的已知问题。
|
||||
- 建议使用 `WaitFor()` 代替以避免永久阻塞。
|
||||
|
||||
**示例:**
|
||||
|
||||
Reference in New Issue
Block a user