Added WhileLocked() utility method.