Improved lock handling Part 1: better error reporting.

Maintain lock ownership and report who owns the lock when an obtain_lock fails.

Part 2 will be the maintaining of a locks list and automatic reporting of abandoned locks (threads exiting while holding a lock(s)).

Part 3 will be adding support for Robust Mutexes, including to fthreads.