A function that checks that the current thread is holding the passed in lock, and panics if that's not the case.
A no-op when lock tracking is not enabled.