... He(Uncle Vernon) shooed the shocked Masons back into the dining room, promised Harry he would flay him to within an inch of his life when the Masons had left, and handed him a mop. ...
I think "flay him to within an inch of his life" is figurative. But I'm not sure about what sense of 'flay' has been used from the following dictionary-suggesting definitions:
When someone flays an animal or person, they remove their skin, usually when they are dead.
If you flay someone, you criticize them severely for their beliefs, policies, or actions.
What does this phrase convey exactly?
-- Excerpted from Harry Potter.