docs: update memory and threading API docs

This commit is contained in:
2026-03-20 02:35:24 +08:00
parent c5b17239ca
commit fd792b7df1
103 changed files with 2485 additions and 673 deletions

View File

@@ -10,6 +10,8 @@ void WriteUnlock()
**返回:**
**线程安全:**
**复杂度:** O(1)
**注意:** 必须在持有写锁的线程中调用。
@@ -17,10 +19,14 @@ void WriteUnlock()
**示例:**
```cpp
ReadWriteLock rwLock;
std::unordered_map<String, int> cache;
#include "XCEngine/Threading/ReadWriteLock.h"
#include <unordered_map>
#include <string>
void UpdateCache(const String& key, int value) {
XCEngine::Threading::ReadWriteLock rwLock;
std::unordered_map<std::string, int> cache;
void UpdateCache(const std::string& key, int value) {
rwLock.WriteLock();
cache[key] = value;
rwLock.WriteUnlock();
@@ -29,4 +35,5 @@ void UpdateCache(const String& key, int value) {
## 相关文档
- [ReadWriteLock 总览](readwritelock.md) - 返回类总览
- [`ReadWriteLock`](readwritelock.md) - 返回类总览
- [`WriteLock`](writelock.md) - 获取写锁