Files
XCEngine/docs/api/threading/read-write-lock/writeunlock.md
ssdfasd d34d040563 Fix broken links in Threading API docs
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>
2026-03-26 01:30:37 +08:00

728 B

ReadWriteLock::WriteUnlock

void WriteUnlock()

释放写锁。唤醒所有等待中的读者和下一个写者。

参数:

返回:

线程安全:

复杂度: O(1)

注意: 必须在持有写锁的线程中调用。

示例:

#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();
}

相关文档