std::scoped_lock (C ++17)

suggest change

std::scoped_lock provides RAII style semantics for owning one more mutexes, combined with the lock avoidance algorithms used by std::lock. When std::scoped_lock is destroyed, mutexes are released in the reverse order from which they where acquired.

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

Feedback about page:

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

Table Of Contents