Safely work with locked data by using lambdas to wrap some piece of code
post C++ C++11 Lambda Concurrency