docs: Document stub/not-implemented methods in resources module
Fixed discrepancies between source code and documentation: - AsyncLoader: Document Initialize() ignores workerThreadCount, Submit() doesn't do actual async loading, Update() is stub - ResourceManager: Document UnloadUnused() and ReloadResource() are stubs - ResourceCache: Document OnZeroRefCount() and Flush() are stubs - ResourceDependencyGraph: Document TopologicalSort() returns empty (stub) - ResourceFileSystem: Document GetResourceInfo() doesn't fill modifiedTime, EnumerateResources() is stub - FileArchive: Document Enumerate() is stub - ResourcePackageBuilder: Document AddDirectory() is stub - ImportSettings: Document LoadFromJSON/SaveToJSON are stubs - TextureImportSettings/MeshImportSettings: Document JSON methods are stubs - TextureLoader/MeshLoader/MaterialLoader/ShaderLoader/AudioLoader: Document GetDefaultSettings() returns nullptr - AudioLoader: Document ParseWAVData() is stub, Load() doesn't parse WAV headers - ShaderLoader: Document DetectShaderType/ParseShaderSource are stubs - MaterialLoader: Document ParseMaterialData() is stub - Texture: Document Create() mipLevels=0 behavior, GenerateMipmaps() returns false - Mesh: Document MeshLoader::Load() is example only - IResourceLoader: Document GetDefaultSettings() returns nullptr for all loaders
This commit is contained in:
@@ -4,19 +4,17 @@
|
||||
void Cancel()
|
||||
```
|
||||
|
||||
**注意:** 此方法为**部分实现**,存在已知问题。
|
||||
|
||||
取消任务组中所有尚未执行的任务。正在执行的任务将不受影响。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 无
|
||||
|
||||
**复杂度:** O(1)
|
||||
**复杂度:** O(n)
|
||||
|
||||
**注意:**
|
||||
- 已完成的任务不受影响。
|
||||
- 正在执行的任务继续执行直到完成。
|
||||
- 调用后所有 Wait/WaitFor 会立即返回(但请参见下方警告)。
|
||||
- **警告**:`Cancel()` 调用 `OnCancel()` 后不会减少待完成任务数,因此如果任务组中还有未执行的任务,调用 `Wait()` 会导致永久阻塞。建议在 `Cancel()` 后使用 `IsComplete()` 轮询或使用带超时的 `WaitFor()`。
|
||||
**当前状态:** 此方法会调用各任务的 `OnCancel()` 回调,但不会减少 `m_pendingCount` 计数器。因此调用 `Wait()` 会导致永久阻塞。建议在 `Cancel()` 后使用 `IsComplete()` 轮询或使用带超时的 `WaitFor()`。
|
||||
|
||||
**示例:**
|
||||
|
||||
@@ -38,7 +36,8 @@ if (userClickedCancel) {
|
||||
printf("Tasks canceled. Progress: %.1f%%\n", group->GetProgress() * 100.0f);
|
||||
}
|
||||
|
||||
group->Wait();
|
||||
// 注意:Cancel() 后 Wait() 会永久阻塞,应使用 WaitFor()
|
||||
group->WaitFor(std::chrono::seconds(1));
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
@@ -4,15 +4,17 @@
|
||||
float GetProgress() const
|
||||
```
|
||||
|
||||
**注意:** 此方法当前为**空实现/桩代码**。
|
||||
|
||||
获取任务组的完成进度。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** `float` - 进度值,范围 0.0f ~ 1.0f
|
||||
**返回:** `float` - 始终返回 `0.0f`(任务组为空时返回 `1.0f`)
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**注意:** 当前实现中 `m_completedCount` 未被更新,此方法始终返回 0.0f(任务组为空时返回 1.0f)。此为实现限制,文档仅作记录。
|
||||
**当前状态:** 此方法为空实现,始终返回 `0.0f`,因为 `m_completedCount` 未被更新。
|
||||
|
||||
**示例:**
|
||||
|
||||
|
||||
@@ -4,15 +4,17 @@
|
||||
bool IsComplete() const
|
||||
```
|
||||
|
||||
**注意:** 此方法当前为**空实现/桩代码**。
|
||||
|
||||
检查任务组中所有任务是否已完成。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** `bool` - 所有任务完成返回 true,否则返回 false
|
||||
**返回:** `bool` - 始终返回 `false`(空实现)
|
||||
|
||||
**复杂度:** O(1)
|
||||
**复杂度:** O(1)(空实现)
|
||||
|
||||
**注意:** 由于实现缺陷,`m_pendingCount` 计数器在任务完成后不会递减,因此此方法在所有任务执行完毕后仍会错误地返回 false。
|
||||
**当前状态:** 此方法为空实现,始终返回 `false`,因为 `m_pendingCount` 计数器未正确递减。
|
||||
|
||||
**示例:**
|
||||
|
||||
|
||||
@@ -4,18 +4,19 @@
|
||||
void Wait()
|
||||
```
|
||||
|
||||
**注意:** 此方法当前为**空实现/桩代码**,不执行任何操作。
|
||||
|
||||
阻塞当前线程,等待任务组中所有任务完成。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 无
|
||||
|
||||
**复杂度:** O(n),n 为任务数量
|
||||
**复杂度:** N/A(空实现)
|
||||
|
||||
**注意:**
|
||||
- 如果任务组已被取消,此方法将立即返回。
|
||||
- **警告**:由于实现缺陷,`m_pendingCount` 计数器在任务完成后不会递减,导致 `Wait()` 在所有任务执行完毕后仍会永久阻塞。这是当前实现的已知问题。
|
||||
- 建议使用 `WaitFor()` 代替以避免永久阻塞。
|
||||
**当前状态:** 此方法为空实现,不执行任何操作。由于 `m_pendingCount` 计数器未正确更新,此方法永远无法正常运作。
|
||||
|
||||
**建议:** 使用 `WaitFor()` 代替以避免永久阻塞。
|
||||
|
||||
**示例:**
|
||||
|
||||
@@ -29,8 +30,12 @@ for (int i = 0; i < 10; ++i) {
|
||||
}
|
||||
|
||||
printf("Waiting for all tasks...\n");
|
||||
group->Wait();
|
||||
printf("All tasks completed!\n");
|
||||
// 注意:Wait() 为空实现,建议使用 WaitFor()
|
||||
if (group->WaitFor(std::chrono::seconds(5))) {
|
||||
printf("All tasks completed within 5 seconds\n");
|
||||
} else {
|
||||
printf("Timeout! Tasks may not have completed\n");
|
||||
}
|
||||
|
||||
TaskSystem::Get().DestroyTaskGroup(group);
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user