Add support for write-locking a lock that has already been write-locked by this thread