std::scoped_lock (C++17)

suggest change

std::scoped_lock provides RAII style semantics for owning one or more mutexes, combined with the lock avoidance algorithms used by std::lock. When std::scoped_lock is destroyed, each owned mutex is unlocked. The standard does not require that unlock to happen in the reverse order of acquisition.

{
    std::scoped_lock lock{_mutex1,_mutex2};
    //do something
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents