Throw an exception when trying to deallocate a locked mutex.