On the selection of std::unique_lock and std::lock_guard in CPP11

when I see the conditional variables section of CPP11, I find that all conditional variables are used in conjunction with locks, but at this time they all use unique_lock instead of lock_guard,. Can you explain that?


seems to be because the existence of lock_guard itself is strongly related to mutex, that is to say, once lock_ lock_ exists, the mutex must be locked, while in the condition variable, there is a procedure to release the lock

.
Menu