Fix 14 broken cross-references in docs/api/threading/: - lambda-task path: lambdatask -> lambda-task (5 occurrences) - task-system-config path: tasksystemconfig -> task-system-config (6 occurrences) - read-write-lock self-ref: readwritelock -> read-write-lock (6 occurrences) - task-system cross-method: createtaskgroup/destroytaskgroup -> create-task-group/destroy-task-group - thread cross-method: getcurrentid/getid -> get-current-id/get-id Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
40 lines
728 B
Markdown
40 lines
728 B
Markdown
# ReadWriteLock::WriteUnlock
|
|
|
|
```cpp
|
|
void WriteUnlock()
|
|
```
|
|
|
|
释放写锁。唤醒所有等待中的读者和下一个写者。
|
|
|
|
**参数:** 无
|
|
|
|
**返回:** 无
|
|
|
|
**线程安全:** ✅
|
|
|
|
**复杂度:** O(1)
|
|
|
|
**注意:** 必须在持有写锁的线程中调用。
|
|
|
|
**示例:**
|
|
|
|
```cpp
|
|
#include "XCEngine/Threading/ReadWriteLock.h"
|
|
#include <unordered_map>
|
|
#include <string>
|
|
|
|
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();
|
|
}
|
|
```
|
|
|
|
## 相关文档
|
|
|
|
- [`ReadWriteLock`](read-write-lock.md) - 返回类总览
|
|
- [`WriteLock`](writelock.md) - 获取写锁
|