book: revise the description of RAII (#288)

This commit is contained in:
mq白
2024-06-01 18:09:32 +08:00
committed by GitHub
parent 2659a5f207
commit 7b57e5e5a1
2 changed files with 3 additions and 2 deletions

View File

@@ -35,7 +35,7 @@ C++11 introduces a class related to `mutex`, with all related functions in the `
It can be locked by its member function `lock()`, and `unlock()` can be unlocked.
But in the process of actually writing the code, it is best not to directly call the member function,
Because calling member functions, you need to call `unlock()` at the exit of each critical section, and of course, exceptions.
At this time, C++11 also provides a template class `std::lock_guard` for the RAII syntax for the mutex.
At this time, C++11 also provides a template class `std::lock_guard` for the RAII mechanism for the mutex.
RAII guarantees the exceptional security of the code while keeping the simplicity of the code.