lock_guard simplifies the usage of mutex in C++. It holds a lock on its mutex from the time it is created to the end of its scope. This simplifies the writing of locking and unlocking code using a mutex.
See this earlier example for usage of a mutex to control concurrent access to a queue from multiple threads. Below is the same written using lock guard:
Tried with: Visual C++ 2013