Raise an error when no lock is available and with_locked_resource is
called.