std::unique_lock<std::mutex> lock(m_Mutex)
时间: 2023-12-08 08:45:28 浏览: 82
引用\[2\]中提到,std::unique_lock<std::mutex> lock(m_Mutex)会创建一个名为lock的std::unique_lock对象,并将它锁定到名为m_Mutex的std::mutex对象上。这样可以确保在同一时间只有一个线程能够访问互斥量保护的资源。这是一种常见的使用互斥量的方式。
#### 引用[.reference_title]
- *1* *3* [windows 线程核心内容](https://blog.csdn.net/baidu_16370559/article/details/103120788)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [std::unique_lock<std::mutex> lock(mutex_);](https://blog.csdn.net/weixin_35752122/article/details/129085209)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文