common/thread: Added lock acquisition/release log messages

This should help track down deadlocks when using:
  -DENABLE_LOCK_CHECKS=ON

For best results, also configure with the following, to get a
file name and line number. (Heads up -- lots of output!)
  -DENABLE_LOG_FILE_INFO=ON