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>
39 lines
689 B
Markdown
39 lines
689 B
Markdown
# ReadWriteLock::ReadUnlock
|
|
|
|
```cpp
|
|
void ReadUnlock()
|
|
```
|
|
|
|
释放读锁。如果这是最后一个读者,将唤醒等待中的写者。
|
|
|
|
**参数:** 无
|
|
|
|
**返回:** 无
|
|
|
|
**线程安全:** ✅
|
|
|
|
**复杂度:** O(1)
|
|
|
|
**注意:** 必须与 ReadLock 配对使用,且在持有读锁的线程中调用。
|
|
|
|
**示例:**
|
|
|
|
```cpp
|
|
#include "XCEngine/Threading/ReadWriteLock.h"
|
|
|
|
XCEngine::Threading::ReadWriteLock rwLock;
|
|
float sharedData = 0.0f;
|
|
|
|
float GetData() {
|
|
rwLock.ReadLock();
|
|
float data = sharedData;
|
|
rwLock.ReadUnlock();
|
|
return data;
|
|
}
|
|
```
|
|
|
|
## 相关文档
|
|
|
|
- [`ReadWriteLock`](read-write-lock.md) - 返回类总览
|
|
- [`ReadLock`](readlock.md) - 获取读锁
|