The analyzer has detected an incorrect use of the 'std::unique_lock' class potentially leading to a race condition.
Consider the following example:
class C {
std::mutex m_mutex;
void foo() {
std::unique_lock <std::mutex>(m_mutex);
}
};
In this code, a new variable called 'm_mutex' is created and initialized to a default value. It means that the mutex will not be locked.
Fixed code:
void foo() {
std::unique_lock <std::mutex> var(m_mutex);
}
This diagnostic is classified as:
Was this page helpful?
Your message has been sent. We will email you at
If you do not see the email in your inbox, please check if it is filtered to one of the following folders:
Take
a chance!