Create lock in loop