2 ms·
Another common addition to these lockable objects is having a free function variant of 'with' that allows visiting multiple objects: MutexProtected<X> x;
by gpderetta 4y ago
Another common addition to these lockable objects is having a free function variant of 'with' that allows visiting multiple objects:
MutexProtected<X> x;
MutexProtected<Y> y;
...
with(x, y, [](X& x, Y& y) {....} );
Using the scoped_lock protocol this can avoid deadlocks.