Lock shared structure.