There is no need for this second `lock_guard` one `lock_guard` instance in a scope is sufficient to both lock and unlock a mutex. Take a look at the code in the `producer_consumer_queue` example, it is similar.