This is a very tricky question. It’s not as simple as saying after 10 or even 20 minutes there’s no hope. For example, people who have been subject to hypothermia, have their heart stopped for over 45 minutes, and still have been successfully revived.
Even under normal circumstances numerous factors need to be considered when deciding when to stop trying to resuscitate someone, such as how quickly CPR was started after their heart stopped; how well CPR was performed.
CPR has one important function and that is to supply the body, and most importantly the brain, with adequate blood flow. The generally accepted rule of thumb is that brain cells begin to die after approximately 4 to 6 minutes without sufficient supply of blood. After around 10 minutes, those cells will cease functioning, and the persona will be effectively dead