Skip to content

Commit 711694e

Browse files
authored
book: typo fix (changkun#189)
1 parent 645fa62 commit 711694e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

book/zh-cn/07-thread.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ C++11 引入了 `mutex` 相关的类,其所有相关的函数都放在 `<mutex
3333

3434
`std::mutex` 是 C++11 中最基本的 `mutex` 类,通过实例化 `std::mutex` 可以创建互斥量,
3535
而通过其成员函数 `lock()` 可以进行上锁,`unlock()` 可以进行解锁。
36-
但是在在实际编写代码的过程中,最好不去直接调用成员函数,
36+
但是在实际编写代码的过程中,最好不去直接调用成员函数,
3737
因为调用成员函数就需要在每个临界区的出口处调用 `unlock()`,当然,还包括异常。
3838
这时候 C++11 还为互斥量提供了一个 RAII 语法的模板类 `std::lock_guard`
3939
RAII 在不失代码简洁性的同时,很好的保证了代码的异常安全性。

0 commit comments

Comments
 (0)