HPCC-11966 Extend locking primitives to add assertLocked()

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
This doesn't work when something is recursively locked and then unlocked.