by pavlov · 3y ago · 0 comments
Another potential disadvantage, is that you lose the possibility to control the unlock order, when you have multiple nested locks.
std::scoped_lock allows locking multiple locks.
When I'm writing multithreaded code, the first line of any block containing a RAII lock is the lock. Any subsection of code that needs another lock gets its own block.