add lock object to guarantee the atomicity of register