Remove a bunch of unnecessary manual locking.  When using RAII objects (like unique_lock, for example), when the object goes out of scope it automatically unlocks.  So there's no need to do this before a return statement, before going out of scope (e.g. inside a while loop), etc.