6
condition_variable.notify_one ()을 호출하기 전에 잠금을 획득해야합니까?
사용에 대해 약간 혼란 스럽습니다 std::condition_variable. 전화하기 전에 unique_lock에 를 만들어야한다는 것을 이해 합니다. 내가 찾을 수없는 것은 나는 또한 호출하기 전에 고유 잠금을 획득해야하는지 여부입니다 또는 .mutexcondition_variable.wait()notify_one()notify_all() cppreference.com의 예 는 상충됩니다. 예를 들어, notify_one 페이지 는 다음 예를 제공합니다. #include <iostream> #include <condition_variable> #include <thread> #include <chrono> std::condition_variable cv; …