Add SynchronizedValue
-
SynchronizedValue hides access to T behind a with_lock function which accepts a lambda (which takes either T& or T const& as argument) as argument.
-
SynchronizedValue::with_lock first locks an internal mutex, and invokes the lambda with the contained T
-
One can specify the mutex type, and the lock types as template arguments
-
In case the lambda takes a T const&, with_lock uses a readLock, and in case it takes a T&, it uses a writeLock (which may actually be the same type as the readLock)
-
update some code which was using a similar class to use SynchronizedValue
Edited by Marco Cattaneo